I decided to try programming for Android. I started their tutorial, but could not run the application which the first project automatically creates. I suspect that I have set up my computer wrong, but don't know where to search for the error.
The tutorial says to go to the directory of the newly created project and run ant debug
. This throws an error for me: java.lang.NoClassDefFoundError: com.android.sdklib.internal.build.DebugKeyProvider
. I suspect a bad installation of the SDK, but have no idea what is wrong or how to repair it.
My computer runs openSUSE 12.1 64 bit. I have the Oracte JDK version 1.7.0_04 installed, and the Android SDK including Tools and the platforms Android 4.0 and 4.0.3. After the installation, I added the android tools folder to my path environment and added a udev rule for my phone, but have done no further customization. Adb sees my phone and I can capture a screenshot with ddms. I don't use Eclipse.
Did I miss some part of the setup? How do I troubleshoot this problem?
Update I found a mailing list discussion about somebody with the same problem. He solved it by updating a symlink called "keytool" in their /usr/bin, to point at the correct file. I didn't have such a link, so I created it. The problem persists. Somebody who answered the thread suggested that a file called "jarutil.jar" may be missing from the SDK. I don't have such a file in my SDK, even after a reinstall from scratch. As the discussion is over an year old, I don't even know if such a file should be present in the current version.
Here is the full output from the ant debug
command:
rumtscho@bradbury:~/dev/learn-android/MyFirstApp> ant debug Buildfile: /home/rumtscho/dev/learn-android/MyFirstApp/build.xml
-set-mode-check:
-set-debug-files:
-set-debug-mode:
-debug-obfuscation-check:
-setup: [echo] Creating output directories if needed... [echo] Gathering info for MyFirstApp... [setup] Android SDK Tools Revision 19 [setup] Project Target: Android 4.0.3 [setup] API level: 15 [setup] [setup] ------------------ [setup] Resolving library dependencies: [setup] No library dependencies. [setup] [setup] ------------------ [setup] API<=15: Adding annotations.jar to the classpath. [setup] [setup] ------------------ [setup] WARNING: No minSdkVersion value set. Application will install on all Android versions.
-build-setup:
-pre-build:
-code-gen: [echo] ---------- [echo] Handling aidl files... [aidl] No AIDL files to compile. [echo] ---------- [echo] Handling RenderScript files... [renderscript] No RenderScript files to compile. [echo] ---------- [echo] Handling Resources... [aapt] No changed resources. R.java and Manifest.java untouched. [echo] ---------- [echo] Handling BuildConfig class... [buildconfig] Generating BuildConfig class.
-pre-compile:
-compile: [javac] Compiling 1 source file to /home/rumtscho/dev/learn-android/MyFirstApp/bin/classes
-post-compile:
-obfuscate:
-dex: [dex] Found modified input file [dex] Converting compiled files and external libraries into /home/rumtscho/dev/learn-android/MyFirstApp/bin/classes.dex...
-crunch: [crunch] Crunching PNG Files in source dir: /home/rumtscho/dev/learn-android/MyFirstApp/res [crunch] To destination dir: /home/rumtscho/dev/learn-android/MyFirstApp/bin/res
[crunch] Crunched 0 PNG files to update cache-package-resources: [aapt] Creating full resource package...
-package: [apkbuilder] Current build type is different than previous build: forced apkbuilder run. [apkbuilder] Creating MyFirstApp-debug-unaligned.apk and signing it with a debug key...
BUILD FAILED /home/rumtscho/android-sdk-linux/tools/ant/build.xml:886: The following error occurred while executing this line: /home/rumtscho/android-sdk-linux/tools/ant/build.xml:897: The following error occurred while executing this line: /home/rumtscho/android-sdk-linux/tools/ant/build.xml:307: java.lang.NoClassDefFoundError: com.android.sdklib.internal.build.DebugKeyProvider at java.lang.Class.initializeClass(libgcj.so.12) at com.android.sdklib.build.ApkBuilder.getDebugKeystore(ApkBuilder.java:919) at com.android.ant.ApkBuilderTask.execute(ApkBuilderTask.java:334)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at java.lang.reflect.Method.invoke(libgcj.so.12) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at java.lang.reflect.Method.invoke(libgcj.so.12) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:398) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at java.lang.reflect.Method.invoke(libgcj.so.12) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
at com.android.ant.IfElseTask.execute(IfElseTask.java:124) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at java.lang.reflect.Method.invoke(libgcj.so.12) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
at com.android.ant.IfElseTask.execute(IfElseTask.java:124) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at java.lang.reflect.Method.invoke(libgcj.so.12) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at java.lang.reflect.Method.invoke(libgcj.so.12) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:398) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at java.lang.reflect.Method.invoke(libgcj.so.12) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:390) at org.apache.tools.ant.Target.performTasks(Target.java:411) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809) at org.apache.tools.ant.Main.startAnt(Main.java:217) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109) Caused by: java.lang.ClassNotFoundException: java.security.KeyStore$ProtectionParameter at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1361) at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1311) at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1064) at java.lang.ClassLoader.loadClass(libgcj.so.12) at java.lang.Class.initializeClass(libgcj.so.12) ...48 moreTotal time: 3 seconds