Android, Proguard 'Unknown option 'and' in argument number 9' - android

I'm getting the following error every time I try to export my application from Eclipse.
Proguard returned with error code 1. See console
proguard.ParseException: Unknown option 'and' in argument number 9
at proguard.ConfigurationParser.parse(ConfigurationParser.java:170)
at proguard.ProGuard.main(ProGuard.java:491)
I'm using the defualt proguard.cfg file that Eclipse generated. My android sdk is in C:\Android\SDK(here)
My default.properties file is like this:
target=android-7
proguard.config=proguard.cfg
I have also done a clean and build.
I also made sure Eclipse and my SDK tools were up to date.

The 'spaces in the pathnames' problem is well documented here - note that you can use Junctions/Links to get around this without moving or renaming files...
The Dalvik error is usually just Eclipse 'having a moment' - a 'Clean Project' and Rebuild usually cures it.

So, in my workspace for the name of the project I had C:\workspace\Name Android Name for the name, so I changed that to C:\workspace\NameName, then I changed my sdk to C:\sdk, then I exported to C:\NameAndroidName.apk, and I got the failure to convert to dalvik format error.
And then I went to this question and that solved the dalvik format error, and it exported successfully.

Related

Unknown Android deployment JSON file location

I tried to follow this example : http://doc.qt.io/qtcreator/creator-mobile-app-tutorial.html
But when I try to build it, I have this error :
23:51:49: Internal Error: Unknown Android deployment JSON file
location. Error while building/deploying project accelbubble (kit:
Android for armeabi (GCC 4.9, Qt 5.4.1)) When executing step "Build
Android APK
There is not a lot of things about this on the Internet, so I came here for help.
Anyone know what to do ?
You need to select the run configuration for the project: see comments on this Qt bug report
Select the 'Project' icon on the left toolbar, choose 'Run' on that active target, and the set "Run Configuration".
My problem occured when I tried to build a library for Android.
I managed to solve it by removing corresponding records in projectname.pro.user file.
Quit QtCreator
remove the elements containing apk attribute and
install attribute. Not the attributes, but the elements containing them
run QtCreator and make sure there are no build apk and install steps in the project's build configuration
I also made sure there are no extra projectname.pro.user.* files and removed them, but I don't know if that matters.
Problem solved by installing QT on C:\Qt disk instead of D:\Program Files\Qt (my second hard drive, because the C is SSD and doesn't have much space).

Project has no project.properties file! Edit the project properties to set one error

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.

Build errors while trying to set up OpenCV4Android

I am trying to run an OpenCV4Android in my eclipse. I am working on Linux(CentOS 6).
I have done everything mentioned in this link but I am still getting build errors. I have also set the NDK path in preferences hat is not mentioned in the tutorial and tried a lot more things. When I try to build the library project the console gives:
"Cannot run program "/ndk-build": Unknown reason
Error: Program "/ndk-build" is not found in PATH"
All the projects also have build errors and the src and gen folders in openCV4 Library is not created and the build path shows:
"Unable to get system library for the project"
When i try to change the project properties I get an error saying the page contains invalid values and I cannot change the android api version. Plz help. Have been trying to set this up since 3 days now.
Thank you.
First Clean and Build you library Project alone and then try cleaning all your projects. In order to solve the "Cannot run program "/ndk-build": Unknown reason Error: Program "/ndk-build" is not found in PATH" error, Try the following steps:
Head to the project's properties. If you're using Windows, the shortcut is Alt + Enter; or simply right-click the project name to find its properties.
Go to the C/C++ Build section; under Builder Settings tab in Build command: text box you're likely to find something similar to that below, if it's empty then type in the similar text - namely: ${NDKROOT}/ndk-build.cmd where NDKROOT, as its name implies, refers to the path where your NDK root folder exists.
Now you must inform eclipse what NDKROOT equates to; as in, where is the NDK root path. You can do this by heading to (in your project's properties) C/C++ Build > Environment > press Add…
Now add your environment variable named NDKROOT (the Name) with the relevant path (Value). Note that you're to repeat this per NDK project. You would get a window similar to that below.
Press OK to the New variable input window and then OK again to the properties window.
Hopefully this will help!

Eclipse - Several Errors After Altering Proguard and Manifest Files

I have an Android project for which I use the Eclipse IDE and I wanted to try an use the ProGuard tool to obfuscate/shrink my code. Unfortunately I couldn't get it to work with Eclipse throwing up a ProGuard error when I try to export my project.
To resolve this I altered the necessary project properties file to NOT use ProGuard but Eclipse just complained there were errors with the project which needed to be resolved. I tried cleaning the project, refreshing too but all to no avail. As I use a Mercurial for source control I reverted to my last good sources but now Eclipse throws up even more errors which I cannot get rid of:
org.eclipse.core.internal.resources.ResourceException: Resource is out
of sync with the file system: '/XXXXX/AndroidManifest.xml'.
loadAndParseRClass: failed to find manifest package for project
XXXXXXX
I've never been a great fan of Eclipse but how can I clean my project and get it back to a NON proguard state?
I resolved the problem. There's ANOTHER error log in Eclipse called 'Problems' which tells me my Debug certificate has expired on 25/12/2011. Handy how Eclipse labels this as a 'problem' and not an error and gives no indocation other that a red x that there's some sort of problem!
Anyway I resolved this by going here.
Make sure you Refresh your project so that the state of your Workspace/IDE agrees with your state on disk (Right click on the project and select "Refresh"). This will get rid of the first error you have.
And then just do a Team -> Revert on your projects and select the files that you have changed and want to revert to the checked-in version.

"Conversion to Dalvik format failed with error 1" -- on export only

I know this is a repeat question but I've read and tried every solution on this site and I'm still getting the error; also, I'm getting it ONLY when I export my signed apk from Eclipse. I'm able to build and run the unsigned apk.
I have:
Deleted (and later restored) all libraries from the build path
Cleaned and rebuilt all my projects
Restarted Eclipse with -clean option
Re-create the app project from scratch
I know error 1 means I have duplicate symbols but I've checked, clean and rebuilt my build path a million times and I still get the error, only when I export.
If I had duplicate symbols, wouldn't I get an error 1 for my unsigned apk too?
If I really do have duplicate symbols, how can I get Eclipse to tell me what they are? All I get from the export wizard is a one-line error dialog. :(
I don't get any errors when I manually sign the apk, but when I install it on a phone I get a simple error: "Application not installed." :(:(
My project structure is as follows:
One Android library project with 99% of my code. It has one copy of the required jar files in the build path.
One Android app project with two classes. It references the library project via the Android tab, NOT the Java build path. There are no additional sources, projects or libraries referenced in the build path except for Android 2.1. I even re-created this project from scratch (I didn't re-created the library project because it's much bigger).
Everything was working a few days ago! Any suggestions are much appreciated!
Thanks in advance...
EDIT-UPDATE: The error goes away when I disable Proguard. Very strange.
This is an issue with Proguard in the Windows developer tools - edit Android SDK\tools\proguard\bin\Proguard.bat
Replace:
call %java_exe% -jar "%PROGUARD_HOME%"\lib\proguard.jar %*
with:
call %java_exe% -jar "%PROGUARD_HOME%"\lib\proguard.jar %1 %2 %3 %4 %5 %6 %7 %8 %9
Keep a reference to this solution because next time you update the SDK tools it'll probably be reintroduced (has been present in last few releases).
Upgrade your Proguard to its latest version i.e., 4.7...
Dowload the zip from http://sourceforge.net/projects/proguard/files/latest/download?source=files .... then copy the "lib" and "bin" folders from the zip to your sdk/tools/proguard/ to replace the default or say old "bin" and "lib" .... try exporting your project once again...
Go to project and unselect Build Automatically. Then Clean the project and Build all. Worked for me to export signed application package
This was driving me insane too. I tried everything, changed all my external libraries and so on but nothing worked. I tried a newer version of proguard without success.
Turns out I was using a library called "GridLayout" to support older devices. After I renamed the class "GridLayout" to "CustomGridLayout" it worked fine. Seems like you can't have duplicate class names.
Here was the key that worked for me
http://android.foxykeep.com/dev/fix-the-conversion-to-dalvik-format-failed-with-error-1-with-adt-14
Supposedly fixed in ADT-15, the workaround is
1) For each X_src element,right click on it and then Build Path > Remove from build path.
2) A popup will open. Make sure that “Also unlink the folder from the project” is checked and then accept it.
You can still debug into library code but you need to manage your breakpoints in those projects and then step through the code in the class file tabs.
I tried a few of the above solutions, and had no luck. Then, I closed Eclipse, and re-opened it, and was able to export successfully. If I try again however, it wouldn't work.
So, I think maybe I only get one successful export per "open" of Eclipse. Not an ideal solution by any means, but when all else fails give it a shot. It worked for me.
The accepted answer to this question (from 2011) did not work for me. However, the correct answer to this question is posted here:
Android export give a "Conversion to Dalvik format failed error1"
Unselect Build Automatically works for me. Tanks anjaneya;
0)Unselect Build Automatically
1) Clean the project
2) Build project.
3) Export Signed Application in Android Tools options.

Categories

Resources