2016-09-29 74 views
1

我有一個ionic 2.0.0-rc0應用程序,我想構建n個android平臺。當我運行 ionic run android時,它在兩者之間失敗。 StackTrace-由於JDK-9無法使用離子形成android

> [email protected] build /home/raj/ionic/github 
    > ionic-app-scripts build 
    [07:46:11] ionic-app-scripts 0.0.23 
    [07:46:11] build prod started ... 
    [07:46:11] clean started ... 
    [07:46:11] clean finished in 9 ms 
    [07:46:11] copy started ... 
    [07:46:11] ngc started ... 
    [07:46:11] lint started ... 
    [07:46:11] copy finished in 171 ms 
    [07:46:12] lint finished in 960 ms 
    [07:46:26] ngc finished in 15.36 s 
    [07:46:26] bundle prod started ... 
    [07:46:34] bundle prod finished in 8.27 s 
    [07:46:34] sass started ... 
    [07:46:36] sass finished in 1.67 s 
    [07:46:36] minify started ... 
    [07:46:36] cleancss started ... 
    [07:46:36] uglifyjs started ... 
    [07:46:47] uglifyjs finished in 10.80 s 
    [07:46:47] cleancss finished in 10.80 s 
    [07:46:47] minify finished in 10.80 s 
    [07:46:47] build prod finished in 36.12 s 
    Running command: /home/raj/ionic/github/hooks/after_prepare/010_add_platform_class.js /home/raj/ionic/github 

    :CordovaLib:compileDebugJavaWithJavac FAILED 


    FAILURE: Build failed with an exception. 
    Error: /home/raj/ionic/github/platforms/android/gradlew: Command  failed with exit code 1 Error output: 
    FAILURE: Build failed with an exception. 

    * What went wrong: 
    Execution failed for task ':CordovaLib:compileDebugJavaWithJavac'. 
    > Could not create an instance of type com.sun.tools.javac.api.JavacTool. 

我使用genymotion作爲模擬器,即使我不認爲在這個問題上的問題。這個問題的很多解決方案是設置JAVA_HOME路徑。但我已經設置了它, echo $JAVA_HOME > /usr/lib/jvm/java-9-openjdk-amd64。我懷疑這是gradle 2.1java-9 from this的問題。我一直堅持這一段時間,任何幫助將不勝感激。

+0

Android SDK不支持Java 9.降級至8(尚未) – calebeaires

回答

5

愚蠢的我認爲這將是一個偉大的想法嘗試JDK-9當大 甲骨文警告我不要。刪除它並安裝JDK-8,問題解決了。 Oracle確實看到了我的未來。

+0

這實際上不是解決方案,因爲JDK 9現在是Oracle Java Web站點上的默認下載選項。 – incorelabs

+0

這是因爲它現在穩定。我的問題是由於版本不穩定 – raj

+0

但這個答案不再是解決這個問題的方法。 :) – incorelabs

-2
cordova platform update android 
ionic build android 
ionic run android 

嘗試運行這些命令。希望這將幫助你:)

+0

其最新的android版本。所以更新不是問題。 – raj

+0

離子建設android給你同樣的錯誤? –

+0

是的。 ''>無法創建com.sun.tools.javac.api.JavacTool.''類型的實例。這是問題。我認爲openjdk是一個問題。我正在重新安裝它。 – raj

相關問題