Okay, so I've been trying to figure out this problem for a few weeks now and been on StackOverflow profusely viewing similar problems and trying to apply them to my own situation to no avail. I am worried I am just doing something incredibly stupid or forgetting something stupid and will waste someone's time but I'm out of options and ideas at this point, so apologies if that ends up being the case. I'm not using Eclipse or Android Studio, just CLI Maven. I need to use the DrawerLayout in my app, but the app crashes when attempting to instantiate it due to not being able to find the class (and presumably the rest of the support-v4 package) at runtime. So, step by step.
Here's the line of code that creates the DrawerLayout:
DrawerLayout drawer = new android.support.v4.widget.DrawerLayout(this);
Here's the stack trace of how the app crashes when it tries to create a new instance of the DrawerLayout.
E/AndroidRuntime( 2065): FATAL EXCEPTION: main
E/AndroidRuntime( 2065): Process: com.patron.main, PID: 2065
E/AndroidRuntime( 2065): java.lang.NoClassDefFoundError: android.support.v4.widget.DrawerLayout
E/AndroidRuntime( 2065): at com.patron.main.FlashMenu.onCreate(FlashMenu.java:120)
E/AndroidRuntime( 2065): at android.app.Activity.performCreate(Activity.java:5933)
E/AndroidRuntime( 2065): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
E/AndroidRuntime( 2065): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
E/AndroidRuntime( 2065): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
E/AndroidRuntime( 2065): at android.app.ActivityThread.access$800(ActivityThread.java:144)
E/AndroidRuntime( 2065): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
E/AndroidRuntime( 2065): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 2065): at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime( 2065): at android.app.ActivityThread.main(ActivityThread.java:5221)
E/AndroidRuntime( 2065): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 2065): at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime( 2065): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
E/AndroidRuntime( 2065): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
W/ActivityManager( 1228): Force finishing activity com.patron.main/.FlashMenu
Here's how I'm including the dependency in my POM.xml:
<dependency>
<groupId>com.android.support</groupId>
<artifactId>support-v4</artifactId>
<version>21.0.3</version>
<type>aar</type>
<exclusions>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</exclusion>
</exclusions>
</dependency>
I'm using the local maven repository provided by google in the android-sdk/extras/android/m2repository folder as suggested by another SO post. Obviously it can compile and run ok so I'm confident it's finding it properly. When I call mvn dependency:build-classpath to see the compile-time classpath, it shows me this:
And then manually opening that AAR folder in 7zip and checking the classes jar to ensure the DrawerLayout is in there, I can see it most certainly is:
So at this point I am unsure what I can change or do to get this support package available at runtime. I went over the classpath in detail and I am confident I am not importing the support-v4 package twice, just once, and judging by the nature of errors from importing it twice I don't think I'd be able to compile if that were the problem. I tried manually setting the scope of the dependency to compile (which should be the right one), then to runtime and provided just in case without any luck. If anyone has any ideas as to what the problem could be to solve this NoClassDefFoundError, it would be most appreciated.
Figured it out. For posterity:
You need to update to the latest version of the Android Maven Plugin, in order to avoid this error. In addition, an old bug I was running into where ActivityCompat21 was not being found along several other classes that I fixed with a hacky workaround is also fixed by updating to version 4.0.0-rc2 of the plugin.
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>4.0.0-rc.2</version>
<extensions>true</extensions>
<configuration>
<includeLibsJarsFromAar>true</includeLibsJarsFromAar>
</configuration>
</plugin>
Related
My Application is running fine in Emulators and even in real devices installed by android studio for debugging purpose, but it is crashing if installed manually using apk file.
I am ready to paste any other codes, like Activity if required.
Here is the logcat:
04-14 12:20:44.392 6220-6220/? I/art: Late-enabling -Xcheck:jni
04-14 12:20:44.465 6220-6220/test.planner W/System: ClassLoader referenced unknown path: /data/app/test.planner-1/lib/arm
04-14 12:20:44.467 6220-6220/test.planner I/InstantRun: starting instant run server: is main process
04-14 12:20:44.470 6220-6220/test.planner D/AndroidRuntime: Shutting down VM
04-14 12:20:44.471 6220-6220/test.planner E/AndroidRuntime: FATAL EXCEPTION: main
Process: test.planner, PID: 6220
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{test.planner/test.planner.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "test.planner.MainActivity" on path: DexPathList[[zip file "/data/app/test.planner-1/base.apk"],nativeLibraryDirectories=[/data/app/test.planner-1/lib/arm, /vendor/lib, /system/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2327)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.ClassNotFoundException: Didn't find class "test.planner.MainActivity" on path: DexPathList[[zip file "/data/app/test.planner-1/base.apk"],nativeLibraryDirectories=[/data/app/test.planner-1/lib/arm, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at android.app.Instrumentation.newActivity(Instrumentation.java:1067)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2317)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Suppressed: java.lang.ClassNotFoundException: test.planner.MainActivity
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 12 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
Just go to:
Android Studio --> File --> Setting --> Build, execution, deploy --> Instant run.
and disable instant run.
If you just upgraded your android studio.
You will not have this option to disable -> Instant Run. (not on the menu)
Seems like with new android studio and gradle upgrade in order to install an apk you need to properly build it.
Option 1: with gradle from command line
./gradlew :appName:clean
./gradlew :appName:build
Option 2: from android studio
Android Studio -> build -> build APK (or generate sighed APK)
The generated apk can be installed fine on a device.
Note: if you start a new applicate with this version of android studio you will see that when you run from studio there is no apk generated anymore.
I faced the similar problem.
Note the size of Apk, it would be very small in size , this is because of the instant run feature in enabled. Just disable it
May be Android Studio is not including all files in Apk, when we use the instant run to fasten the process.
Any body know why this happening?
Go to :
Android Studio --> File --> Setting --> Build, execution, deploy --> Instant run.
Android Studio --> File --> Setting --> Build, execution, deploy --> Instant run.
and disable instant run.
I am using ListViewAnimations core library version 3.1.0 in my android application. I have only included lib-core library as per the setup instructions. But unfortunately I am receiving following error java.lang.NoClassDefFoundError:
java.lang.NoClassDefFoundError: Failed resolution of: [Lcom/nineoldandroids/animation/Animator;
11-23 14:47:18.489 14928-14928/com.gi.giml E/AndroidRuntime: at com.nhaarman.listviewanimations.appearance.AnimationAdapter.animateViewIfNecessary(AnimationAdapter.java:174)
11-23 14:47:18.489 14928-14928/com.gi.giml E/AndroidRuntime: at com.nhaarman.listviewanimations.appearance.AnimationAdapter.getView(AnimationAdapter.java:145)
11-23 14:47:18.489 14928-14928/com.gi.giml E/AndroidRuntime: at android.widget.AbsListView.obtainView(AbsListView.java:2346)
11-23 14:47:18.489 14928-14928/com.gi.giml E/AndroidRuntime: at android.widget.ListView.makeAndAddView(ListView.java:1875)
11-23 14:47:18.489 14928-14928/com.gi.giml E/AndroidRuntime: at android.widget.ListView.fillDown(ListView.java:702)
11-23 14:47:18.489 14928-14928/com.gi.giml E/AndroidRuntime: at android.widget.ListView.fillFromTop(ListView.java:763)
11-23 14:47:18.489 14928-14928/com.gi.giml E/AndroidRuntime: at android.widget.ListView.layoutChildren(ListView.java:1684)
11-23 14:47:18.489 14928-14928/com.gi.giml E/AndroidRuntime: at android.widget.AbsListView.onLayout(AbsListView.java:2148)
11-23 14:47:18.489 14928-14928/com.gi.giml E/AndroidRuntime: at android.view.View.layout(View.java:16630)
11-23 14:47:18.489 14928-14928/com.gi.giml E/AndroidRuntime: at android.view.ViewGroup.layout(ViewGroup.java:5437)
11-23 14:47:18.489 14928-14928/com.gi.giml E/AndroidRuntime: at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
I am using this animation library in my app like below:
ListView lv = new ListView(getActivity());
SwingBottomInAnimationAdapter bottomInAnimationAdapter = new SwingBottomInAnimationAdapter(new ArrayAdapter<String>(getActivity(), R.layout.subgroup_list_layout, R.id.textView, result));
bottomInAnimationAdapter.setAbsListView(lv);
lv.setAdapter(bottomInAnimationAdapter);
Any idea what I am doing wrong?
ListViewAnimations is based on NineOldAndroids and several classes reference com.nineoldandroids.animation.Animator directly. So you need to include this library as well.
If you're using gradle, this is done automatically by only declaring
dependencies {
compile 'com.nhaarman.listviewanimations:lib-core:3.1.0#aar'
}
in your build.gradle. The same holds if you're using Maven and pom.xml. Otherwise you need to follow the instructions on the page you linked yourself:
Download the jar files you need: (lib-core)
Download the latest NineOldAndroids.jar file
Add the .jar files to your project's libs folder, or add them as external jars to your project's build path.
You should also include "nineoldandroids-2.4.0.jar" file in your project along with dependencies {
compile 'com.nhaarman.listviewanimations:lib-core:3.1.0#aar'
}
add jar file to the lib folder and add this line in dependency
compile files('libs/nineoldandroids-2.4.0.jar') it works fine for this error "java.lang.NoClassDefFoundError: Failed resolution of: [Lcom/nineoldandroids/animation/Animator;"
link to download jar file https://github.com/downloads/JakeWharton/NineOldAndroids/nineoldandroids-2.4.0.jar
I'm using the application class , so I had to create the manifest file, as follows:
<application
android.name="com.moonae.android.common.ApplicationClass"
android.icon="#drawble/ic_launcher"
android.largeHeap="true"
....>
<activity..../>
I have to work normally without problems when testing , often the error occurred in the Google Play Store error report.
But the error report is posted on the Android version 4.4 , I even tested at 4.4 operate normally.
If the person experiencing this problem help me.
java.lang.RuntimeException: Unable to instantiate application com.moonae.android.common.ApplicationClass: java.lang.ClassNotFoundException: Didn't find class "com.culturelandnew.android.common.ApplicationClass" on path: DexPathList[[],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:516)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4524)
at android.app.ActivityThread.access$1500(ActivityThread.java:163)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1317)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5335)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.moonae.android.common.ApplicationClass" on path: DexPathList[[],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:67)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.app.Instrumentation.newApplication(Instrumentation.java:993)
at android.app.LoadedApk.makeApplication(LoadedApk.java:511)
... 11 more
<application
android.name="com.moonae.android.common.ApplicationClass"
android.icon="#drawble/ic_launcher"
android.largeHeap="true"
....>
<activity..../>
is this a typo? i have not seen this before i mean android.name to android:name..btw
quick suggestion, remove your application tag, and use the eclipse gui side to search the application class and reference it.. mostly it references the it without package name included.. like this.. =>
<application
android:name="ApplicationClass"
android:icon="#drawble/ic_launcher"
android:largeHeap="true"
....>
I'm trying to use the libsodium crypto library (a portable version of NaCl (nacl.cr.yp.to)) on Android but I can't figure out how to properly compile/use the Kalium-JNI language binding.
So far I successufully compiled libsodium as described on the libsodium website. In addition, I used the new android-arm compile script added 3 days ago. As a test I compiled the android-x86 version as well to compare the file sizes of the resulting library files. They differ so this seems to be working.
As a next step I installed KaliumJNI using the newly generated android-arm libsodium files. No problems here.
In my little android-maven test application which basically is a "Hello World" archetype I'm simply trying to generate a new keypair:
import org.abstractj.kalium.keys.KeyPair;
KeyPair Alice = new KeyPair();
IntelliJ succesfully compiled my little program but when I try to run it on my emulator (or on my Nexus S) it crashes. First it crashed because it wasn't able to find the kaliumjni library so I added libtestjni.so (which is the .so library generated by KaliumJNI) to my project properties which fixed this problem. The next error message I got told me that libtestjni.so is not 32bit (I'm running a 64bit Ubuntu 12.04LTS). I don't see why it has to be 32bit but anyway I managed to set up a 32bit Ubuntu 12.04LTS VM and compiled android-arm libsodium and KaliumJNI again to generate a 32bit libtestjni.so file. But when I use this 32bit file in my original application (on my 64bit machine) I receive the following error:
java.lang.IllegalStateException: Could not execute method of the activity
at android.view.View$1.onClick(View.java:3823)
at android.view.View.performClick(View.java:4438)
at android.view.View$PerformClick.run(View.java:18422)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at android.view.View$1.onClick(View.java:3818)
at android.view.View.performClick(View.java:4438)
at android.view.View$PerformClick.run(View.java:18422)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app-lib/IM.CRYPTO-1/libtestjni.so" has unexpected e_machine: 3
at java.lang.Runtime.loadLibrary(Runtime.java:364)
at java.lang.System.loadLibrary(System.java:526)
at org.abstractj.kalium.NaCl.<clinit>(NaCl.java:36)
at org.abstractj.kalium.keys.KeyPair.<init>(KeyPair.java:36)
at IM.CRYPTO.HelloAndroidActivity.buttonClick(HelloAndroidActivity.java:43)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at android.view.View$1.onClick(View.java:3818)
at android.view.View.performClick(View.java:4438)
at android.view.View$PerformClick.run(View.java:18422)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
I've spent hours to get to this point but right now I'm clueless where I should go from here. It seems that e_machine: 3 stands for some kind of architecture issue but I can't figure out where I went wrong. The application is compiled for Android 4.0 (Android API 14) and the emulator is configured to use arm and the same API 14 as well (The Nexus phone runs CM with Android 4.3.1). As mentioned before libsodium was compiled for arm as well.
Some more information:
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>IM.CRYPTO</groupId>
<artifactId>cryptolibAndroid</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>apk</packaging>
<name>cryptolibAndroid</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<platform.version> 4.0.1.2
</platform.version>
<android.plugin.version>3.6.0</android.plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>${platform.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.abstractj.kalium</groupId>
<artifactId>kalium-jni</artifactId>
<version>1.0.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>${android.plugin.version}</version>
<extensions>true</extensions>
<configuration>
<undeployBeforeDeploy>true</undeployBeforeDeploy>
<attachJar>true</attachJar>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<configuration>
<sdk>
<platform>14</platform>
</sdk>
</configuration>
</plugin>
</plugins>
</build>
NaCl.java
(this class gets called to load testjni (KaliumJNI))
package org.abstractj.kalium;
public class NaCl {
public static Sodium sodium() {
return SingletonHolder.SODIUM_INSTANCE;
}
private static final String LIBRARY_NAME = "sodium";
private static final class SingletonHolder {
public static final Sodium SODIUM_INSTANCE = new Sodium();
}
private NaCl() {
}
static {
System.loadLibrary("testjni");
}
}
I'm grateful for any hints to point me into the right direction.
Please note that I have a little JAVA desktop application as well which uses libsodium + Kalium (NOT KaliumJNI) and runs without any problems.
As Alex Cohn hinted at: The library (.so-file) is compiled for the Intel x86 architecture while the device (or emulator) you are trying to run the app on uses some other architecture (assuming ARM). So the relevant line in the output you posted is:
Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app-lib/IM.CRYPTO-1/libtestjni.so" has unexpected e_machine: 3
How did you compile the library? Usually, you download the Android NDK and use some provided Makefile (named Android.mk) to compile the library. Do not use the compiler shipped with your Linux-Distribution (called host compiler) to generate libraries that are thought to run on an Android-device.
I'm having trouble running the vitamio-sample from https://github.com/yixia/VitamioBundle.
I am building it with Android Studio and it compiles fine and runs, but when it gets to this line:
if (!io.vov.vitamio.LibsChecker.checkVitamioLibs(this))
return;
It throws an exception when I run it on my Nexus 5 (and also on a Galaxy S4):
01-22 11:58:40.759 12323-12323/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: io.vov.vitamio.demo, PID: 12323
java.lang.UnsatisfiedLinkError: Couldn't load vinit from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/io.vov.vitamio.demo-1.apk"],nativeLibraryDirectories=[/data/app-lib/io.vov.vitamio.demo-1, /vendor/lib, /system/lib]]]: findLibrary returned null
at java.lang.Runtime.loadLibrary(Runtime.java:358)
at java.lang.System.loadLibrary(System.java:526)
at io.vov.vitamio.Vitamio.<clinit>(Vitamio.java:258)
at io.vov.vitamio.LibsChecker.checkVitamioLibs(LibsChecker.java:40)
at io.vov.vitamio.demo.VitamioListActivity.onCreate(VitamioListActivity.java:40)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
The exception also happens when I'm running the v4.2.0 tree in my own app.
Any idea what I'm missing? In my own app I pulled the vitamio project into a libraries folder and am referencing it like this:
compile(project(':libraries:vitamio'))
The sample project is left as-is.
I am not sure if there is a cleaner way in the newer version of Vitamino (or gradle). But here is how I got it to work with gradle build tools 0.6.
Added a project to my /libraries directory with the vitamino source/sdk. This has a /libs/armeabi /libs/armeabi-v7a with libvinit.so inside.
In my build.gradle for my main project, reference the library project like:
dependencies {
// other dependencies
compile(project(':libraries:vitamio'))
}
Add the following to the bottom of my build.gradle
task copyNativeLibs(type: Copy) {
from(new File(project(':libraries:vitamio').getProjectDir(), 'libs')) { include '**/*.so' }
into new File(buildDir, 'native-libs')
}
tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn copyNativeLibs }
clean.dependsOn 'cleanCopyNativeLibs'
tasks.withType(com.android.build.gradle.tasks.PackageApplication) { pkgTask ->
pkgTask.jniDir new File(buildDir, 'native-libs')
}
Then when i run a clean and rebuild it will copy the native libs to the proper spot and include them in the build.