Android: Getting source code from an APK file with R.java

帅比萌擦擦* 提交于 2019-12-10 11:57:42

问题


I used the instruction here : Is there a way to get the source code from an APK file? It was really good. I got almost everything of my lost project but no R.java file. It is nececery to import the project to eclipse. How can I extract this file from apk file? Where can I find it?

tnx.


回答1:


R.java is created automatically on Eclipse and other IDEs. Removing the line from my main activity that says import R.java usually helps my IDE recognize that it's not there, and it recreates it when you try to run the program. If that doesn't work, try Project, Clean... and try running it again.




回答2:


You cannot directly extract r.java file, but the contents of r.java file can be extracted using 'aapt' tool. the following command gives list of all resources and their respective IDs as present in r.java file:

aapt d resources name_of_apk



回答3:


You don't need the R.java file. It is automatically generated by the Android SDK when you try to run your android application.



来源:https://stackoverflow.com/questions/11596141/android-getting-source-code-from-an-apk-file-with-r-java

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!