简体   繁体   English

无法将AOSP代码导入IDEA / Intellij / Android Studio

[英]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 我在计算机上下载并构建了新的android lollipop源代码,并尝试将代码导入到IDE中,我在此处尝试了intellij和android studio

https://stackoverflow.com/a/21471652/3057931 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 我尝试执行development / tools / idegen / idegen.sh文件,但似乎不断收到Java文件错误

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. 这个方法在KitKat源代码中对我有用,但是在此版本中,我一直收到此错误。

I really don't know what to do anymore. 我真的不知道该怎么办了。

I really really need to use intellij or android studio for the AOSP code. 我真的真的需要使用intellij或android studio作为AOSP代码。

PLEASE HELP. 请帮忙。

res.java is a folder, but idegen.jar recognize it as a regular java code to parse, what is a bug. res.java是一个文件夹,但是idegen.jar会将其识别为要解析的常规Java代码,这是一个错误。

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. 因此,将./out/target/product/hammerhead/obj/GYP/shared_intermediates/res.java重命名为./out/target/product/hammerhead/obj/GYP/shared_intermediates/res.j可以绕过此问题。

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. 现在,将生成android.imlandroid.ipr.classpath

then, you can rename res.j back to res.java if you want. 然后,您可以根据需要将res.j重命名为res.java。

the left is the same as you do before. 左边和以前一样。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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