So I'm dipping my toes into this area for the first time - i followed instructions to install the android SDK and eclipse plug in. I created a blank new android project and I get the following build errors:
[2011-01-08 16:34:55 - xxx]: Dxno classfiles specified
[2011-01-08 16:34:55 - xxx] Conversion to Dalvik format failed with error 1
I've googled the problem and tried to clean and rebuild, or hitting F5 on the project in the explorer but the issue remains. I've verified the build paths and the libraries to make sure only Android 2.3 is there but still get this issue.
I have also tried to load a sample project and I get the same error.
Any ideas?
This problem happens when the java files in the Eclipse project are not compiled to class files. The message indicates that the Android SDK cannot proceed to convert these classes to dalvik format because it could not find them. To solve this problem:
Verify that the src folder is in your build path ( check under "Project Properties" -> "Java build path" ). If this is not the case right-click on the src folder, go to "Build path" and click on "Use as source folder".
Verify that under "Project properties" -> "Builders" you can find "Java builder". If this is not the case close the project and with a text editor open the file .project present in the root folder of the project itself. Add under <buildSpec> the following lines:
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments></arguments>
</buildCommand>
After performing the actions described above, re-open the project and proceed to rebuild it by clicking on "Project" -> "Clean"
I fixed this - none of the above helped.
What i did was delete eclipse, download the latest one and reinstalled the ADT plugin and it works now.
Simply edit the "project.properties" file and comment the line:
proguard.config=proguard.cfg
to be like the following:
#proguard.config=proguard.cfg
then clean the project. Hope this will export to APK successfully.
The answer is detailed here. Try these steps, and it should work out.
I had the same problem: try to clean the project (Project -> Clean...). Eclipse will recreate the right bin directory.
Related
i updated my ide to letest version after update i opend project on which i was working before update but it gave error but when i opend other projects there had no error
please help Thank you
update failed for AnAction(com.intellij.execution.ExecutorRegistryImpl$ExecutorAction) with ID=Run
java.io.FileNotFoundException: E:\Android\WhatsApp\app\build\intermediates\apk_ide_redirect_file\debug\..\..\apk\debug\output-metadata.json (The system cannot find the file specified)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
at java.base/java.io.FileReader.<init>(FileReader.java:75)
just clean project and make a build
It is solved by just rebuild project
Build → Rebuild project
Workaround: if you encounter this error generating an APK, first clean the project (Build -> Clean project)
Open your project.
If your project files are not loaded and instead you see: 'Loading...' cancel Sync Gradle by clicking on X at the bottom, this should show your files back.
Clean Project: Build -> Clean Project
Rebuild Project: Build -> Rebuild Project
In my case, I was unable to Clean Project as well as Sync Gradle Files, So
Eventually I was about to give up, but then I went to
AndroidStudioProjects/project_name/app/build/intermediates/apk_ide_redirect_file/debug in the file explorer and found a file named redirect
That file contained the following information
#- File Locator -
listingFile=../../apk/debug/output-metadata.json
From here, I tried to locate the path mentioned in this file and I was unable to find itSo I searched output-metadata in the file explorer from AndroidStudioProjects/project_name and I found a bunch of output-metadata files, I copied the first one and pasted it in the mentioned location, and then everything worked perfectly
Now I don't know wether this is the right way to solve this or not, but it worked...
Hope it helps you...
I am getting the errors:
Errors occurred during the build.
Errors running builder 'Android Resource Manager' on project 'DashboardActivity'.
java.lang.NullPointerException
and
[2013-09-02 17:55:31 - DashboardActivity] Project has no project.properties file! Edit the project properties to set one.
and
Description Resource Path Location Type
The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files UserFunctions.java /DashboardActivity/src/libary line 1 Java Problem
and
Description Resource Path Location Type
The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Object. Fix the build path then try building this project DashboardActivity Unknown Java Problem
I have already tried cleaning the project and I get the same errors. Only the 'DashboardActivity' project is the one getting this error and my other projects work fine. In my properties Order and Export section there is a part that says "Unable to get system libary for this project"
I know there should be a proper android.jar file here but I don't see one.
Also, the android tools 'fix project properties' does nothing at all when I click on it.
I have the AndroidManifest.xml file as well.
Ever since I first went to clean my project it has created the file "proguard-project.txt" as well.
What can I do to fix this? Thanks in advance!
NOTE: now I can't acess the gen folder or bin folder (there is no little + for me to click on to open it) and now it's saying that R cannot be resolved to a variable) ???
Error while applying
Why don't you do this
Right click on Project Root folder > properties > Java BuildPath > Library Tab
Check whether any of library is missing (showing error with red cross)
if yes then add this library to your project
don't forget to CHECK it on Order and Export
Do one more thing
Right click on Project Root folder > properties > Android > set your Project Build Target
check any one target
Check your Android-sdk path from
Window > Preference > Android
I was also having these errors:
The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Object.
and
The Project Properties Order and Export section has an error "Unable to get system library for this project"
I solved it by Right Clicking on the Project Root folder > properties > Android > set your Project Build Target and changed it to the highest target I could trust from working on other projects.
It has been 3 years since I had this project working. So I noticed when I was troubleshooting tonight, that the manifest did not have a targetSdkVersion, only a minSdkVersion of "8". So I had changed that to this:
After doing the above 2 things, all my errors were gone -- however (!) ... a bit later tonight, I was trying to export my project to an .apk. And Eclipse crashed. Upon re-opening it, Eclipse is super broken. I am about to do a re-boot my PC now - and thus need to finish posting this. I trust Eclipse will be back to normal. But the reason I am mentioning this is that I suspect I may need to re-install Eclipse as I have been getting other minor start-up errors when I open Eclipse. And the errors I had tonight in that app were very strange and unusual.
I just recently upgraded to the newest version of Android Studio (0.1.1), but I also used Android Studio to relocate my project to my Dropbox folder. So, I'm not exactly sure which one is causing this problem. When I build or try to run my project I get this error:
Cannot start compilation: the output path is not specified for modules
"actionbarsherlock",
"EmPubLite-EmPubLite".
Specify the output path in Configure Project.
I can't find any reference to "Configure Project" and the Project Structure option under File no longer works in this release.
Solution for Android Studio version < 1.0 :
You just have to go to your Modules settings > Project and specify a "Project compiler output"
and make your modules inherit from project. (For that go to Modules > Paths > Inherit project.
Or you can specify your output for each module if you want.
In order to do so you just need to follow this steps:
Open Project structure (F4 on one of the modules in the project explorer)
Click on Project tab on the left
Define "Project compiler output:" as YOUR_PROJECT_PATH\out (or any folder you want)
Click on Modules tab on the left
Go over all your modules and verify that under the Paths tab the Compiler output is set to "Inherit project compile output path"
I ended up re-importing the project using Gradle and it's back to normal. Very weird issue.
this is a problem that I face in case I open my phonegap project with Android Studio and Webstorm.
They are IntelliJ-based project and I guess they are both writing the files in .idea
Reimporting the project is the solution.
got same error while using studio feature to import from GitHub repository.
I deleted the whole project and .. cloned it using git terminal and imported as new project ... studio prompted to add VCS root, accepted ....everything was fine afterwards. As #lordhong prompted.
I found this:
http://www.chrisdew.com/blog/2013/07/17/android-studio-nosuchmethoderror-lazystringarraylist/
it is realy help for me.
Thus, in my case, the problem was to have two libraries:
protobuf-2.4.1.jar
and new protobuf-2.5.0.jar
it resulted error:
APK path is not specified for module “Example-Example”
To correct this, rename file protobuf-2.4.1.jar to protobuf-2.4.1.jar.disabled
mv protobuf-2.4.1.jar protobuf-2.4.1.jar.disabled
How I finally managed to fix after hours!
File -> Project Structure -> Facets -> choose module's facet -> Packaging. Enter in APK Path absolute path to apk to be created: C:\workspace\MyCompany\MyProject\myProject.apk
Press ok and run your project
I am adding admob external jar in my project and i am using andengine as a library project but when i try to export the project i get this error. Also adding andengine library project adds andengine.jar also in android dependencies. Is that suppose to happen?
I have tried almost all other answers on stackoverflow but nothing seems to work.
If anyone can help me pls?
Following is my project image
Just solved this problem. I updated my sdk to latest and that solved the problem!
Try exit eclipse, backup if you want, delete gen and bin folders. Start eclipse again, build then export.
This usually happens to me after either eclipse has been running for a long time or after I have build a signed apk successfully. To fix it I just restart eclipse.
In Eclipse, select the project causing the error- go to the menu project -> properties -> java build path -> libraries and remove all jars including the android jars.
Then, right click the project, go to android tools -> fix project properties. Then, add back any other external jars you wanted to add to the build path following the same menu project -> properties -> java build path -> libraries. To ensure there are no errors due to missing libraries.
Then, do a 'clean' on menu project and build again. It should work.
After updating to the latest developer tools, ADT 14, my Android project that includes library projects will no longer run producing the error:
Dx UNEXPECTED TOP-LEVEL EXCEPTION: ... already added: ...
...
Conversion to Dalvik format failed with error 1
The other threads describing this issue with solutions that include removing and re-adding the projects do not work.
This problem is listed as a known issue of ADT 14. Here's the quote from the Android Tools Project Site:
Project not building with error
[2011-10-20 23:32:04 - MyApp] Dx UNEXPECTED TOP-LEVEL EXCEPTION:<class>: already added: <class>
This is due to a failure to remove previous library source folders from the
main project. Incidentally, the fragility around those linked source
folders is one of the reason we are moving away from this mechanism
(see more info at
http://tools.android.com/recent/buildchangesinrevision14). The
solution is to remove those <libraryname>_src source folders from
your projects. Just right click them and choose Build Path > Remove
from Build Path. You should also be prompted to remove the linked
folder which you should do. If you're not prompted, remove it
manually. You can see some screenshot of the problem in this great
post:
http://android.foxykeep.com/dev/fix-the-conversion-to-dalvik-format-failed-with-error-1-with-adt-14
Solution:
As it says, the solution is to remove the <libraryname>_src source folders from your projects. You can do this by right clicking them and choose "Build Path -> Remove from Build Path" or in your project properties (Java Build Path -> Source tab).
I also ran into this problem, but none of the above fixed it:
Tried removing/re-adding libraries with clean builds along the way
Tried deleting and re-importing projects
No dice. Still the "Conversion to Dalvik format failed with error 1" was staring me in the face every time I tried to export to an apk.
I could tell the problem was related to ProGuard, because when I commented out this line in my project.properties file, everything worked fine:
proguard.config=proguard.cfg
However, I wasn't able to solve the problem until I found this post by David M Young. Apparently, ADK/ADT 14 shipped with an incorrect version of ProGuard (oops!). I downloaded ProGuard version 4.6. Replaced the android-sdk\android-sdk\tools\proguard\lib directory contents with proguard4.6.zip\proguard4.6\lib (3 *.jar files), restarted Eclipse and export to apk worked again!
To solve you should:
Right click on your project>Properties>Java Build Path and remove all libs but the one Android I.J (depending on your version)
Project>Clean
Add back the libs you've removed
If the problem comes back another times it's useful to put the libs outside your project and import them as "External JARs"
Hello thought I'd throw my two cents in here. as I did do that,
"_src -> Remove from path"
Then I cleaned it and rebuilt and I could get it to run in debug mode on my phone just fine. I could also export it; but only if I disabled proguard. of course I couldn't leave it like that with my code open for all to see. so it was quite madding. but I Finally found a cure, oddly enough they had the same problem (and fix) with r12 as they do with this one.
it's in: [Android SDK Installation Directory]\tools\proguard\bin\proguard.bat
Change
call %java_exe% -jar "%PROGUARD_HOME%"\lib\proguard.jar %*
to
call %java_exe% -jar "%PROGUARD_HOME%"\lib\proguard.jar %1 %2 %3 %4 %5 %6 %7 %8 %9
I tried tons of other stuff but this is what did it for me.
This is a known problem with the android sdk. Check out this blogpost for a fix.
I used a library for my project and had the same error - it was solved by removing library and src-folder, cleaning and adding it back and cleaned again.
Remove
Project properties -> Android: Remove libs, 'Apply'
Remove included library src-folder
better clean,
Add again
Project properties -> Android: Add libs again, 'Apply'
Clean project
Just had this problem come back again (fixed first time by removing the _src items as mentioned in other answers) - this time there were no _src files to remove. The error was relating the android-support-v4.jar which was included as part of a linked library project as well as part of the main project itself.
Error Dx UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Landroid/support/v4/content/ModernAsyncTask$WorkerRunnable;
Problem went away after removing the android-support-v4.jar file from the build path for the main project. Don't think I came across this as possible cause to the errors.
Go to Project » Properties » Java Build Path » Libraries and remove all except the "Android X.Y" (in my case Android 1.5). click OK. Go to Project » Clean » Clean projects selected below » select your project and click OK. That should work.
It is also possible that you have a JAR file located somewhere in your project folders (I had copied the Admob JAR file into my src folder) and THEN added it as a Java Path Library. It does not show up under the Package Explorer, so you don't notice it, but it does get counted twice, causing the dreaded Dalvik error 1.
Another possible reason could be package name conflicts. Suppose you have a package com.abc.xyz and a class named A.java inside this package, and another library project (which is added to the dependency of this project) which contains the same com.abc.xyz.A.java, then you will be getting the exact same error. This means, you have multiple references to the same file A.java and can't properly build it.
I had the same issue, I'm using the ADT 20.0.3.
Steps I followed to resolve this.
Remove all the jar in project/lib folder and reference them as external jars.
Check android dependencies/reference libraries in project for duplicates,
I've dealt with this problem when using Sherlock ActionBar library in my project. You could do the following step, it's work for me.
Right click to your project, select properties.
A dialog will show up, select 'Java build path' on the left menu.
Remove 'Android dependencies' and 'Android private libraries' on the right panel then click OK
Clean your project (select menu Project --> Clean)
Right click your project, select Android Tools -> Fix project properties
Clean project once again.
Restart your computer
Open eclipse and Export apk
Hope that will help you.