简体   繁体   中英

Failed to import AOSP code to IDEA / Intellij / Android Studio

I downloaded and built the new android lollipop source code on my computer and tried importing the code into an IDE, I tried intellij and android studio using the post here

https://stackoverflow.com/a/21471652/3057931

I tried executing the development/tools/idegen/idegen.sh file but seem to keep getting a java file error

Exception in thread "main" java.io.FileNotFoundException: ./out/target/product/hammerhead/obj/GYP/shared_intermediates/res.java (Is a directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at java.io.FileReader.<init>(FileReader.java:72)
at Configuration.parsePackageName(Configuration.java:204)
at Configuration.rootOf(Configuration.java:180)
at Configuration.traverse(Configuration.java:140)
at Configuration.traverse(Configuration.java:167)
at Configuration.traverse(Configuration.java:167)
at Configuration.traverse(Configuration.java:167)
at Configuration.traverse(Configuration.java:167)
at Configuration.traverse(Configuration.java:167)
at Configuration.traverse(Configuration.java:167)
at Configuration.traverse(Configuration.java:167)
at Configuration.<init>(Configuration.java:72)
at Main.main(Main.java:37)

This method worked for me in the KitKat source code but in this build I keep getting this error.

I really don't know what to do anymore.

I really really need to use intellij or android studio for the AOSP code.

PLEASE HELP.

res.java is a folder, but idegen.jar recognize it as a regular java code to parse, what is a bug.

So rename ./out/target/product/hammerhead/obj/GYP/shared_intermediates/res.java to ./out/target/product/hammerhead/obj/GYP/shared_intermediates/res.j can bypass this issue.

full steps as below:

  1. source build/envsetup.sh
  2. lunch aosp_arm-eng
  3. make
  4. mmm development/tools/idegen/
  5. mv out/target/product/hammerhead/obj/GYP/shared_intermediates/res.java out/target/product/hammerhead/obj/GYP/shared_intermediates/res.j
  6. development/tools/idegen/idegen.sh

now, android.iml , android.ipr and .classpath will be generated.

then, you can rename res.j back to res.java if you want.

the left is the same as you do before.

我遇到了同样的问题,此补丁为我解决了这个问题https://android-review.googlesource.com/#/c/116243/

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