New Android Project Does not compile

I’ve seen Android Studio doesn’t fully install the SDK until the first time it try to use it. I mean, It’s zipped somewhere and the it unzips it. Another thing I found is if you have JDK 1.7 + JDK 1.8 in the same machine it doesn’t like it. But this may be not related to that message. I’ve got rid of that message (on Windows), by manually editing the SDK in Platform Settings->SDKs but the UI designer was still missing.

Having said that, one “good” :wink: news. I see the same problem building in Fire, so it’s not windows only:

Run: “/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/bin/java” -Xmx1024M -classpath “” com.android.sdklib.build.ApkBuilderMain “obj/Debug/Android/org.me.org.me.androidapplication2_unaligned.apk” -z “/Users/jasl/Documents/org.me.androidapplication2/obj/Debug/Android/org.me.org.me.androidapplication2_unsigned.apk” -v -rj “/Applications/Fire.app/Contents/Resources/References/Cooper/cooper.jar” -rj “/Applications/Fire.app/Contents/Resources/References/Cooper/elements.jar”
/Applications/Fire.app/Contents/Resources/XbuildTargets/RemObjects Software/Elements/RemObjects.Elements.Cooper.Android.targets: error : Error: no se ha encontrado o cargado la clase principal com.android.sdklib.build.ApkBuilderMain
Task “AndroidPack” execution – FAILED
Done building target “CooperAndroidAfterCompile” in project “/Users/jasl/Documents/org.me.androidapplication2/org.me.androidapplication2.elements”.-- FAILED
Done building project “/Users/jasl/Documents/org.me.androidapplication2/org.me.androidapplication2.elements”.-- FAILED
Task “MSBuild” execution – FAILED
Done building target “Build” in project “/var/folders/6y/66zx10vj6lx7lvv4sx_1c8wh0000gn/T/org.me.androidapplication2.fire.temp.sln”.-- FAILED
Done building project “/var/folders/6y/66zx10vj6lx7lvv4sx_1c8wh0000gn/T/org.me.androidapplication2.fire.temp.sln”.-- FAILED

Build FAILED.
Errors:

/var/folders/6y/66zx10vj6lx7lvv4sx_1c8wh0000gn/T/org.me.androidapplication2.fire.temp.sln (Build) →
(Build target) →
/Users/jasl/Documents/org.me.androidapplication2/org.me.androidapplication2.elements (default targets) →
/Applications/Fire.app/Contents/Resources/XbuildTargets/RemObjects Software/Elements/RemObjects.Elements.Cooper.Android.targets (CooperAndroidAfterCompile target) →

    /Applications/Fire.app/Contents/Resources/XbuildTargets/RemObjects Software/Elements/RemObjects.Elements.Cooper.Android.targets: error : Error: no se ha encontrado o cargado la clase principal com.android.sdklib.build.ApkBuilderMain
     0 Warning(s)
     1 Error(s)

Time Elapsed 00:00:04.9863140

Regards

I’ve just tried to edit the UI in Fire. I don’t see the “Android SDK is not configured…” message here. It looks fine.
I haven’t touched anything here in Platform Settings, It just fine after the first install. But still the designer is missing.

Regards

I’ve found where the problem (4) could be. There is no sdk/tools/lib/sdklib.jar now.
I see sdklib-25.3.0.jar and sdk-common-25.3.0.jar in that folder. apkbuilder is inside sdklib-25.3.0.jar.
I guess the same kind of problem could be affecting to the UI designer (3). There is a bunch of jar files with the 25.3.0 termination. Note the is no previous version of the files, even having older api levels installed. I have 25.3, 23.3 and 15.5 installed as platforms.

Regards

Thanks, logged as bugs://77391: Cooper: The UI designer is not shown in Android Studio 2.3 and above, when you use “Edit UI files in Android Studio”

Thanks, logged as bugs://77392: Cooper: can’t build/debug with Android 25 and ADS 2.3

It’s curious, i’m running tools 25.0.1 and com.android.sdklib.build.ApkBuilderMain runs just fine for me… Claudio’s log has him using 25.0.0 and failing. Updated to 25.0.2 now, and it’s still fine… This is on Mac, didn’t test Windows.

What could i be missing?

(this is for the compile issue, running

Run: "/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/bin/java" 
 -Xmx1024M 
 -classpath "/Users/mh/Library/Android/sdk/tools/lib/sdklib.jar" 
 com.android.sdklib.build.ApkBuilderMain 
 "obj/Debug/Android/com.remobjects.com.remobjects.androidapplication20_unaligned.apk" 
 -z "obj/Debug/Android/com.remobjects.com.remobjects.androidapplication20_unsigned.apk" 
 -v 
 -rj  "/Users/mh/Code/Elements/Bin/References/Cooper/swift.jar"
 -rj  "/Users/mh/Code/Elements/Bin/References/Cooper/cooper.jar"

/Users/mh/Library/Android/sdk/tools/lib/sdklib.jar exists for me and is recent (i.e. probably updated when i just installed 25.0.2).

—marc

Maybe when you update from older SDKs, the sdklib.jar is preserved. I’d try to delete the SDK folder and reinstall Android Studio 2.3 + its SDK. With the fresh SDK installed you shouldn’t have a sdklib.jar there, instead you should have something like sdklib-25.3.0.jar

Hi Marc, I updated to 25.0.2 and I still have the same issue.

So i take it sdklib.jar *does not * exist for you guys, only sdklib-25.0.3-dev.jar?

curiously, that does not just seem to be a new/renamed version of that library; it does not actually work if i use that one instead of sdklib.jar:

Floorshow:~ mh $ "/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/bin/java"  -Xmx1024M -classpath "/Users/mh/Library/Android/sdk/tools/lib/sdklib-25.3.0-dev.jar" com.android.sdklib.build.ApkBuilderMain "obj/Debug/Android/com.remobjects.com.remobjects.androidapplication20_unaligned.apk" -z "/Users/mh/Test Projects/com.remobjects.androidapplication20/obj/Debug/Android/com.remobjects.com.remobjects.androidapplication20_unsigned.apk" -v -rj  "/Users/mh/Code/Elements/Bin/References/Cooper/swift.jar" -rj  "/Users/mh/Code/Elements/Bin/References/Cooper/cooper.jar"

THIS TOOL IS DEPRECATED. See --help for more information.

Exception in thread "main" java.lang.NoClassDefFoundError: com/android/prefs/AndroidLocation
	at com.android.sdklib.internal.build.DebugKeyProvider.getDefaultKeyStoreOsPath(DebugKeyProvider.java:122)
	at com.android.sdklib.build.ApkBuilder.getDebugKeystore(ApkBuilder.java:944)
	at com.android.sdklib.build.ApkBuilderMain.main(ApkBuilderMain.java:129)
Caused by: java.lang.ClassNotFoundException: com.android.prefs.AndroidLocation
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 3 more

Does manually running that command line (copy the actual command from your go and just adjust the file name to add -25.0.3-dev) work for you guys?

Yes and no, sdklib.jar does not exist for me. But I don’t have sdklib-25.0.3-dev.jar,
mine is sdklib-25.3.0.jar
If I run the command I get the same as you:

/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/bin/java -Xmx1024M -classpath “/Users/jasl/Library/Android/sdk/tools/lib/sdklib-25.3.0.jar” com.android.sdklib.build.ApkBuilderMain “obj/Debug/Android/org.me.org.me.androidapplication3_unaligned.apk” -z “/Users/jasl/Documents/org.me.androidapplication3/obj/Debug/Android/org.me.org.me.androidapplication3_unsigned.apk” -v -rj “/Applications/Fire.app/Contents/Resources/References/Cooper/cooper.jar”

THIS TOOL IS DEPRECATED. See --help for more information.

Exception in thread “main” java.lang.NoClassDefFoundError: com/android/prefs/AndroidLocation
at com.android.sdklib.internal.build.DebugKeyProvider.getDefaultKeyStoreOsPath(DebugKeyProvider.java:122)
at com.android.sdklib.build.ApkBuilder.getDebugKeystore(ApkBuilder.java:944)
at com.android.sdklib.build.ApkBuilderMain.main(ApkBuilderMain.java:129)
Caused by: java.lang.ClassNotFoundException: com.android.prefs.AndroidLocation
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
… 3 more

Also this If I don’t specify the app to build:

/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/bin/java -Xmx1024M -classpath “/Users/jasl/Library/Android/sdk/tools/lib/sdklib-25.3.0.jar” com.android.sdklib.build.ApkBuilderMain

THIS TOOL IS DEPRECATED and may stop working at any time!

If you wish to use apkbuilder for a custom build system, please look at the
com.android.sdklib.build.ApkBuilder which provides support for
recent build improvements including library projects.

A command line tool to package an Android application from various sources.
Usage: apkbuilder [-v][-u][-storetype STORE_TYPE] [-z inputzip]
[-f inputfile] [-rf input-folder] [-rj -input-path]

-v      Verbose.
-d      Debug Mode: Includes debug files in the APK file.
-u      Creates an unsigned package.
-storetype Forces the KeyStore type. If omitted the default is used.
-z      Followed by the path to a zip archive.
        Adds the content of the application package.
-f      Followed by the path to a file.
        Adds the file to the application package.
-rf     Followed by the path to a source folder.
        Adds the java resources found in that folder to the application
        package, while keeping their path relative to the source folder.
-rj     Followed by the path to a jar file or a folder containing
        jar files.
        Adds the java resources found in the jar file(s) to the application
        package.
-nf     Followed by the root folder containing native libraries to
        include in the application package.

Hi, I have the very same output of joseasl

THIS TOOL IS DEPRECATED. See --help for more information.

Exception in thread "main" java.lang.NoClassDefFoundError: com/android/prefs/AndroidLocation
	at com.android.sdklib.internal.build.DebugKeyProvider.getDefaultKeyStoreOsPath(DebugKeyProvider.java:122)
	at com.android.sdklib.build.ApkBuilder.getDebugKeystore(ApkBuilder.java:944)
	at com.android.sdklib.build.ApkBuilderMain.main(ApkBuilderMain.java:129)
Caused by: java.lang.ClassNotFoundException: com.android.prefs.AndroidLocation
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 3 more

Ok, great. we’re getting somewhere. It looks like they just have finally gone ahead and totally broke this tool, as promised. I’m seeing the same as you with a delete and fresh SDK install of only 2.5 We’ll work on a solution (compromise for tomorrow beta, as this might be more work, definitely for next week).

thanx for bringing this to our attention, because i’d never have noticed that myself, having the left over old jar ion place :(.

—marc

Could this be the “new” thing?
https://android.googlesource.com/platform/tools/build/+/master/builder/src/main/java/com/android/builder/AndroidBuilder.java

got it working; will retest the official fix once in have a new build, and tomorrows beta should have it.

this codlin works:

"/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/bin/java"  -Xmx1024M -classpath "/Users/mh/Library/Android/sdk/tools/lib/common-25.3.0.jar:/Users/mh/Library/Android/sdk/tools/lib/sdk-common-25.3.0.jar:/Users/mh/Code/Elements/Source/com.remobjects.apktool/bin/Debug/com.remobjects.apktool.jar" com.remobjects.apktool.ApkBuilderMain "obj/Debug/Android/com.remobjects.com.remobjects.androidapplication20_unaligned.apk" -z "/Users/mh/Test Projects/com.remobjects.androidapplication20/obj/Debug/Android/com.remobjects.com.remobjects.androidapplication20_unsigned.apk" -v -rj  "/Users/mh/Code/Elements/Bin/References/Cooper/swift.jar" -rj  "/Users/mh/Code/Elements/Bin/References/Cooper/cooper.jar"

Great!
What about the UI Designer? Would it work tomorrow too?

Can’t say yet, that issue isn’t mine.

bugs://77392 got closed with status fixed.

Hi Marc,
I am using the free Silver version of Fire, I read that beta access is reserved to license owner. Is there a planned release date for the next Fire release, in order to get this bug fixed? Thanks

Ah.

we’re planning to ship a new release in the next few weeks. But in the mean time, you can grab the beta here: http://secure.remobjects.com/portal/silver.aspx

yours,
marc

bugs://77391 got closed with status fixed.