可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
Compile Error:
Error generating final archive: java.io.FileNotFoundException: ..\bin\resources.ap_ does not exist.
Compile other simple sample works.
Same source file and project works on my college's machine.
Any tips ? Why resources.ap_ doesn't get generated ?
回答1:
Did you do a Project > Clean
? If that doesn't work, try forcing Eclipse to build the project again. Restart Eclipse if that still doesn't work.
回答2:
I created an empty text file under C:\Users\me\workspace\project\bin\resources.ap_
Then Cleaned/Rebuild... that seemed to fix it.
回答3:
In my case was a 9 patch drawable that was modified with GIMP, then adb cannot "parse" it, recreated with the draw9patch then worked fine
回答4:
I was getting both the error in this thread and the one in this post: Android Unknown Command 'crunch'.
Updating the Android SDK inside Eclipse fixed both errors for me.
回答5:
If you delete the whole "gen" folder, then go to Project>Build All it seems to regenerate the folder and the R.java file
回答6:
Finally i found the reason. The update aapt tool treat the format string without order as build error. e.g. "%s %d" should be "%1$s %2$d".
回答7:
I got this along with an error when the "aapt.exe" update tool was run.
There's apparently a bug in this program when the console build output is set to "Verbose". Changing it to "Normal" fixed it for me.
See this link:
aapt.exe is throwing unhandled exception while building *.apk file for Android project in Eclipse
回答8:
Try going to Window->Android SDK manager and update Tools and Android 4.0. This solved my issues.
If that doesnt work, try updating everything.
That totally worked for me!
Reference: Error generating final archive: java.io.FileNotFoundException: xxx\bin\resources.ap_ does not exist
回答9:
Delete bin and gen directories from system. Then F5 in eclipse.
This helped me. Nothing else worked for me.
回答10:
i tried the Notepad Tutorial Exercise 2 and got the same error.
i used the wrong API-Level (3). i just switched to level 8 and now it's working fine.
回答11:
This problem occurred for me after eclipse did some updates. I just went to a backup of my project and took the file that and placed it in the appropriate place in my current project and all worked.
回答12:
Goto file->Properties and change the target to the correct version of android. For me it was 1.5 (from the tutorial on hack-a-day)
回答13:
AndroidManifest.xml displayed within Eclipse was out of sync with what was on disk/being read by Android. shutdown restart eclipse and edit AndroidManifest.xml to be correct and clean and build.
Happens due to having two AndroidManifest.xml files and renaming them. Two useful if two apps from same code base. Linking projects with Android is problematic.
回答14:
I had both values and values-en folders and it was picking the string from the values-en folder. I deleted the en folder and it was back to normal.
I tried
- Clean
- Delete gen
- restart eclipse
回答15:
Here are a few of the things I did that made this finally work for me.
1) I was using Admob ads, and I didn't have an attrs.xml file in my res/values folder
2) I deleted a line that says "import andriod.R" from my main activity, and all my resources connected again and this ultimately made the error go away.
3) The last thing I had wrong is I had a "lib" folder instead of a "libs" folder that held my Admob jar file.
Lastly, I cleaned the project after these changes.
So, hopefully this helps someone else having this same error if none of the above fix the problem.
回答16:
I had the same problem and after digging around the different output Eclipse provides discovered that the issue had to do with a malformed 9-patch image.
I discovered the issue in the Problems output (Alt-Shift-Q then X).
回答17:
I had the same error message and it was caused by having a backslash character in one of my string resource values (in the file: res/values/strings.xml).
I had to remove the offending character and clean the project before it would build.
回答18:
1 - Try Project > Clean
and rebuild project
2 - If clean does not solve this issue, check ALL log in your Console
view in Eclipse.
The issue may not be reported at the end of the Console
view. In my case, it was a drawable that does not respect the 9-patch format. This was reported somewhere in the Console
view but not at the end !!!
回答19:
Delete any 9 patch drawables created in gimp and refresh.
回答20:
- Delete bin and gen on filesystem.
- Refresh (F5) project in Eclipse.
回答21:
I faced the same issue. And I fixed it by removing newly added png file. It was not able to generate resources.ap file because of one of my png file in drawable.
回答22:
I got this problem after the upgrade to Android SDK Tools 15. It was also related to the PNG image as some other replies indicate. After analyzing the Eclipse Console output I found out that the process aapt.exe is crashing while processing of one of the images. More precisely it was in the step labeled as "Including resources from package". To identify the file causing the problem I scanned the Console output, found 3 calls of aapt.exe and each of them I re-ran in the Windows Console. The third one ("aapt.exe package -v -S ...") crashed on one of my PNG files. After I replaced this file (in all supported resolutions) the problem has gone.
回答23:
If you use SurfaceView and have recently changed the name of the package, you might want to check any XML tags that refer to the class.
回答24:
first try
clean,build automatically from eclipse
and if not resolved then try uder solution
i found solution why R.class not made by eclipse after making again-2 clean,build etc.
problem is here in strings.xml:
Hello World, HelloAutoComplete!
HelloAutoComplete these are by default created by the eclipse when you create an projects
definitly you are changing the strings.xml for your own requirment sometimes you cleare the string.xmls these two lines from your codes.
it is making problem in AndroidManifest.xml file
so it cant communicating strings.xml
dont delete these two lines from strings.xml
android:icon="@drawable/icon" android:label="@string/app_name"
android:name=".HelloAutoComplete"
android:label="@string/app_name"
regards aarifmohammadkhan@gmail.com
if any one have nay problem in android
welcome for asking questions
Regards
aarifmkhan
回答25:
You might need to remove extra files from your assets or res directory. One case I had was having both "A.jpg" and "A.JPG" files in the assets directory. It prevented the resources.ap_ file from being generated.
回答26:
For Android studio, if you are using gradle 2.2.2 just disable shrinkResources into build.gradle file:
shrinkResources false
回答27:
Try run your Eclipse as administrator.