android編譯一開始就出現錯誤, 系統告知JDK不支援目前的編譯環境
怪了!之前還可以的耶…(因為我之前是裝sun jdk), 應該是後來有裝OpenJDK套件導致這個錯誤吧
Checking build tools versions…
************************************************************
You are attempting to build with an unsupported JDK.You use OpenJDK but only Sun/Oracle JDK is supported.
************************************************************
由於我還保有原本安裝的sun JDK
所以只要在ubuntu的電腦上透過指令切換版本即可
1 2 3 4 5 6 7 8 9 10 11 12 |
In Ubuntu you don't have to uninstall one JDK to use another. You can have multiple Java versions installed and switch between them as you like. What matters is witch one is set as default. Chose another Java loader: <strong>sudo update-alternatives --config java</strong> Chose another compiler (this is what you need): <strong>sudo update-alternatives --config javac</strong> Chose Java Web Start: <strong>sudo update-alternatives --config javaws</strong> |
備註:
之前在ubuntu10.x版本時, 要編譯Android的環境設置
只要透過 apt-get install sun-java6-jdk 即可安裝, 現在再輸入指令已經找不到了
Ubuntu11.x之後版本, 要透過手動安裝Sun JDK…
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
1.去Oracle<a href="http://www.oracle.com/technetwork/java/archive-139210.html" target="_blank" rel="noopener noreferrer">下載頁面</a> 2.選"Java SE 6", 再選"Java SE Development Kit 6u45" (可能需註冊) 3.下載後的安裝指令: //Make the downloaded binaries executable. chmod u+x jdk-6u45-linux-x64.bin //Extract it ./jdk-6u45-linux-x64.bin //The usr/lib/jvm is the default installation directory of the Java JDK and the Java JRE sudo mkdir -p /usr/lib/jvm sudo mv jdk1.6.0_45 /usr/lib/jvm/ //Inform Ubuntu where your Java installation is located. sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.6.0_45/bin/java" 1 sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.6.0_45/bin/javac" 1 sudo update-alternatives --install "/usr/bin/javah" "javah" "/usr/lib/jvm/jdk1.6.0_45/bin/javah" 1 sudo update-alternatives --install "/usr/bin/javap" "javap" "/usr/lib/jvm/jdk1.6.0_45/bin/javap" 1 sudo update-alternatives --install "/usr/bin/javadoc" "javadoc" "/usr/lib/jvm/jdk1.6.0_45/bin/javadoc" 1 sudo update-alternatives --install "/usr/bin/jar" "jar" "/usr/lib/jvm/jdk1.6.0_45/bin/jar" 1 //Select your default Java installation & Inform Ubuntu sudo update-alternatives --config java sudo update-alternatives --config javac sudo update-alternatives --config javah sudo update-alternatives --config javap sudo update-alternatives --config javadoc sudo update-alternatives --config jar |