简体   繁体   中英

Android Studio Error:java: Cannot find JDK '<unknown>' for module 'appcompat_v7'

I have a load of Android Eclipse projects which I need to get working on a new PC (old one broke). Since Eclipse is now deprecated, I have installed Android Studio rather than Eclipse.

Both old and new PC run Ubuntu 14.04LTS, in case it's relevant.

After I import a project, Eclipse tells me "Error:java: Cannot find JDK '' for module 'appcompat_v7'".

I have tried installing Java 6 JDK (jdk1.6.0_45), Java 7 JDK (jdk1.7.0_79) and Java 8 JDK (jdk1.8.0_51) - no change.

--

Update: After removing appcompat_v7 as a module, I hit two further problems:

  1. I can't add it as a dependency. I don't have a build.gradle, and if I right-click on my app project -> Open Module Settings -> Dependencies -> + -> Library, appcompat_v7 is not there to be selected. SDK Manager reports that I have both Android Support Library and Android Support Repository installed.

...so I removed any reference to appcompat_v7 from my project and tried to run it without...

  1. My project now also reports "Error:java: Cannot find JDK '' for module ''" -- just like it did for appcompat_v7.

The best way I found out of this was not to import Eclipse projects into Android Studio at all - I had to do four, and all four of them gave similar problems.

Instead, just create a new Android Studio project and import the code, resources, XMLs and so on. Fortunately all my projects were fairly small so this wasn't too difficult.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM