Update JDK/JAVA in Android Studio











up vote
2
down vote

favorite












I updated Java, JDK (javac and so on) on my Ubuntu 14, trying out various methods (for which I asked this question).



So after many troubles I'm 99.9% sure Java has been updated on the OS (if I type java -version on terminal, it gives me Java version 1.8.0_101)



But Android Studio, which is the principal reason for my updating the JDK, still gives and error like



"I cannot compile due to the fact that Java 1.8 version is needed" (sorry if i don't have the precise message. If it's needed I will update it)



So the problems seems to be related to Android Studio, not Ubuntu.



How do I make Android Studio notice that I updated my Java version?



Some notes:




  • I'm pretty that my already set as default the 1.8 version, not the 1.7 (I used the sudo update-alternatives --config java command...

  • I installed Android Studio while I still had the 1.7 Java version on my pc, which could have caused this problem

  • (Related to the above point): I actually de-installed and re-installed Android Studio (although it's just a folder to be decompressed, nothing really "installs") but it still gives the error message.


Just a last thing (which may seem odd): actually, before I updated the message was regarding the JDK version, and Android Studio could not even render the application look. After the message concerns more Java version (not JDK) and the application look is rendered, but it does not COMPILE the project.



I'm really sorry for my bad english and the confusion I may have made. Hoping someone will help, thank you really much :)










share|improve this question
















bumped to the homepage by Community 2 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • you need to specify "JAVA_HOME" at studio configs
    – Taher Khorshidi
    Sep 18 '16 at 8:07















up vote
2
down vote

favorite












I updated Java, JDK (javac and so on) on my Ubuntu 14, trying out various methods (for which I asked this question).



So after many troubles I'm 99.9% sure Java has been updated on the OS (if I type java -version on terminal, it gives me Java version 1.8.0_101)



But Android Studio, which is the principal reason for my updating the JDK, still gives and error like



"I cannot compile due to the fact that Java 1.8 version is needed" (sorry if i don't have the precise message. If it's needed I will update it)



So the problems seems to be related to Android Studio, not Ubuntu.



How do I make Android Studio notice that I updated my Java version?



Some notes:




  • I'm pretty that my already set as default the 1.8 version, not the 1.7 (I used the sudo update-alternatives --config java command...

  • I installed Android Studio while I still had the 1.7 Java version on my pc, which could have caused this problem

  • (Related to the above point): I actually de-installed and re-installed Android Studio (although it's just a folder to be decompressed, nothing really "installs") but it still gives the error message.


Just a last thing (which may seem odd): actually, before I updated the message was regarding the JDK version, and Android Studio could not even render the application look. After the message concerns more Java version (not JDK) and the application look is rendered, but it does not COMPILE the project.



I'm really sorry for my bad english and the confusion I may have made. Hoping someone will help, thank you really much :)










share|improve this question
















bumped to the homepage by Community 2 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • you need to specify "JAVA_HOME" at studio configs
    – Taher Khorshidi
    Sep 18 '16 at 8:07













up vote
2
down vote

favorite









up vote
2
down vote

favorite











I updated Java, JDK (javac and so on) on my Ubuntu 14, trying out various methods (for which I asked this question).



So after many troubles I'm 99.9% sure Java has been updated on the OS (if I type java -version on terminal, it gives me Java version 1.8.0_101)



But Android Studio, which is the principal reason for my updating the JDK, still gives and error like



"I cannot compile due to the fact that Java 1.8 version is needed" (sorry if i don't have the precise message. If it's needed I will update it)



So the problems seems to be related to Android Studio, not Ubuntu.



How do I make Android Studio notice that I updated my Java version?



Some notes:




  • I'm pretty that my already set as default the 1.8 version, not the 1.7 (I used the sudo update-alternatives --config java command...

  • I installed Android Studio while I still had the 1.7 Java version on my pc, which could have caused this problem

  • (Related to the above point): I actually de-installed and re-installed Android Studio (although it's just a folder to be decompressed, nothing really "installs") but it still gives the error message.


Just a last thing (which may seem odd): actually, before I updated the message was regarding the JDK version, and Android Studio could not even render the application look. After the message concerns more Java version (not JDK) and the application look is rendered, but it does not COMPILE the project.



I'm really sorry for my bad english and the confusion I may have made. Hoping someone will help, thank you really much :)










share|improve this question















I updated Java, JDK (javac and so on) on my Ubuntu 14, trying out various methods (for which I asked this question).



So after many troubles I'm 99.9% sure Java has been updated on the OS (if I type java -version on terminal, it gives me Java version 1.8.0_101)



But Android Studio, which is the principal reason for my updating the JDK, still gives and error like



"I cannot compile due to the fact that Java 1.8 version is needed" (sorry if i don't have the precise message. If it's needed I will update it)



So the problems seems to be related to Android Studio, not Ubuntu.



How do I make Android Studio notice that I updated my Java version?



Some notes:




  • I'm pretty that my already set as default the 1.8 version, not the 1.7 (I used the sudo update-alternatives --config java command...

  • I installed Android Studio while I still had the 1.7 Java version on my pc, which could have caused this problem

  • (Related to the above point): I actually de-installed and re-installed Android Studio (although it's just a folder to be decompressed, nothing really "installs") but it still gives the error message.


Just a last thing (which may seem odd): actually, before I updated the message was regarding the JDK version, and Android Studio could not even render the application look. After the message concerns more Java version (not JDK) and the application look is rendered, but it does not COMPILE the project.



I'm really sorry for my bad english and the confusion I may have made. Hoping someone will help, thank you really much :)







java jdk openjdk oracle android-studio






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 13 '17 at 12:25









Community

1




1










asked Sep 12 '16 at 19:58









Ema Pall

1125




1125





bumped to the homepage by Community 2 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 2 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.














  • you need to specify "JAVA_HOME" at studio configs
    – Taher Khorshidi
    Sep 18 '16 at 8:07


















  • you need to specify "JAVA_HOME" at studio configs
    – Taher Khorshidi
    Sep 18 '16 at 8:07
















you need to specify "JAVA_HOME" at studio configs
– Taher Khorshidi
Sep 18 '16 at 8:07




you need to specify "JAVA_HOME" at studio configs
– Taher Khorshidi
Sep 18 '16 at 8:07










1 Answer
1






active

oldest

votes

















up vote
0
down vote













Go to File -> Project Structure and check SDK Version. If lower than 1.8 change it.



If it is right, check build.gradle file. Android build-tools 24.0.0 and higher requires Java 1.8. Try to lower them just for the moment.



Check also: https://discuss.gradle.org/t/cant-build-java-1-8-even-with-proper-java-version-in-use/2461/5



It may also a problem with too old Gradle version. Change gradle-plugin version to higher than 2.1.0



But the best way to fix a problem would be this: yesterday was released the newest Android Studio 2.2 with Gradle-plugin 2.2 and Android build-tools 24.0.3. Just update your IDE, it will also fix Gradle and build-tools version.



Hope it will help






share|improve this answer





















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f824158%2fupdate-jdk-java-in-android-studio%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    Go to File -> Project Structure and check SDK Version. If lower than 1.8 change it.



    If it is right, check build.gradle file. Android build-tools 24.0.0 and higher requires Java 1.8. Try to lower them just for the moment.



    Check also: https://discuss.gradle.org/t/cant-build-java-1-8-even-with-proper-java-version-in-use/2461/5



    It may also a problem with too old Gradle version. Change gradle-plugin version to higher than 2.1.0



    But the best way to fix a problem would be this: yesterday was released the newest Android Studio 2.2 with Gradle-plugin 2.2 and Android build-tools 24.0.3. Just update your IDE, it will also fix Gradle and build-tools version.



    Hope it will help






    share|improve this answer

























      up vote
      0
      down vote













      Go to File -> Project Structure and check SDK Version. If lower than 1.8 change it.



      If it is right, check build.gradle file. Android build-tools 24.0.0 and higher requires Java 1.8. Try to lower them just for the moment.



      Check also: https://discuss.gradle.org/t/cant-build-java-1-8-even-with-proper-java-version-in-use/2461/5



      It may also a problem with too old Gradle version. Change gradle-plugin version to higher than 2.1.0



      But the best way to fix a problem would be this: yesterday was released the newest Android Studio 2.2 with Gradle-plugin 2.2 and Android build-tools 24.0.3. Just update your IDE, it will also fix Gradle and build-tools version.



      Hope it will help






      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        Go to File -> Project Structure and check SDK Version. If lower than 1.8 change it.



        If it is right, check build.gradle file. Android build-tools 24.0.0 and higher requires Java 1.8. Try to lower them just for the moment.



        Check also: https://discuss.gradle.org/t/cant-build-java-1-8-even-with-proper-java-version-in-use/2461/5



        It may also a problem with too old Gradle version. Change gradle-plugin version to higher than 2.1.0



        But the best way to fix a problem would be this: yesterday was released the newest Android Studio 2.2 with Gradle-plugin 2.2 and Android build-tools 24.0.3. Just update your IDE, it will also fix Gradle and build-tools version.



        Hope it will help






        share|improve this answer












        Go to File -> Project Structure and check SDK Version. If lower than 1.8 change it.



        If it is right, check build.gradle file. Android build-tools 24.0.0 and higher requires Java 1.8. Try to lower them just for the moment.



        Check also: https://discuss.gradle.org/t/cant-build-java-1-8-even-with-proper-java-version-in-use/2461/5



        It may also a problem with too old Gradle version. Change gradle-plugin version to higher than 2.1.0



        But the best way to fix a problem would be this: yesterday was released the newest Android Studio 2.2 with Gradle-plugin 2.2 and Android build-tools 24.0.3. Just update your IDE, it will also fix Gradle and build-tools version.



        Hope it will help







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Sep 20 '16 at 18:54









        piotrek1543

        488412




        488412






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f824158%2fupdate-jdk-java-in-android-studio%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

            Mangá

            Eduardo VII do Reino Unido