Manifest
<application android:label="#string/app_name"
android:allowBackup="true" android:icon="#mipmap/ic_launcher">
<!-- Tell Cocos2dxActivity the name of our .so -->
<meta-data android:name="android.app.lib_name" android:value="MyGame" />
<activity ............../> </intent-filter> </activity>
</application>
Error:
com.xxx.xxxxxx E/AndroidRuntime: FATAL EXCEPTION: main Process: com.xxx.xxxxxxx, PID: 15913 java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.xxx.xxxxx-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]]
>couldn't find "libMyGame.so" at java.lang.Runtime.loadLibrary(Runtime.java:366)
at java.lang.System.loadLibrary(System.java:989)
at org.cocos2dx.lib.Cocos2dxActivity.onLoadNativeLibraries(Cocos2dxActivity.java:248)
at org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:264)
at android.app.Activity.performCreate(Activity.java:5966)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2408)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2519)
at android.app.ActivityThread.access$800(ActivityThread.java:162)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1412)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:189)
at android.app.ActivityThread.main(ActivityThread.java:5532)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:950)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745)
it redirect me in file
Cocos2dxActivity.java:248 in code line System.loadLibrary(libName);
I am stuck with this error. Help me.
I am using cocos2d-x-3.13
Android NDK, Revision 12
Latest SDK
Android-studio 2.1.3
python 2.7.12
apache-ant 1.9.7
JDK 1.8
Thanks in advance.
couldn't find "libMyGame.so"
This error happens because you didn't compiled for the architecture you are trying to test on.
Change to this in Application.mk file:
APP_ABI := armeabi armeabi-v7a x86
Then recompile and test.
Related
I'm to trying create an application with package name "com.cvs.myapp". App builds perfectly but crashes in device at runtime.
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.cvs.myapp/com.cvs.myapp.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.cvs.myapp.MainActivity" on path: DexPathList[[zip file "/data/app/com.cvs.myapp-DG6fxWRjVXjsKQV_vwJwAw==/base.apk"],nativeLibraryDirectories=[/data/app/com.cvs.myapp-DG6fxWRjVXjsKQV_vwJwAw==/lib/x86, /system/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2843)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.cvs.myapp.MainActivity" on path: DexPathList[[zip file "/data/app/com.cvs.myapp-DG6fxWRjVXjsKQV_vwJwAw==/base.apk"],nativeLibraryDirectories=[/data/app/com.cvs.myapp-DG6fxWRjVXjsKQV_vwJwAw==/lib/x86, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:69)
at androidx.core.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:41)
at android.app.Instrumentation.newActivity(Instrumentation.java:1215)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2831)
It's just a new project with no other additions containing only a MainActivity class. Same new project will work if i rename the package to "com.demo.myapp".
Using Analyse APK, I can see that the classes.dex file doesn't contain the MainActivity. Is the name "cvs" causing the issue as it will work perfectly with any other name instead of it?
gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
build.gradle(project)
classpath 'com.android.tools.build:gradle:3.6.3'
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cvs.myapp">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name="com.cvs.myapp.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
As you mentioned this is happening when you are using the latest Gradle that is currently 3.6.3, It has a new packaging tool ZipFlinger, which might be causing the issue, try below code to disable it
android.useNewApkCreator=false
Moreover I got some relevant links, please have a look.
https://issuetracker.google.com/issues/150198184
After upgrading to android 3.6.1 apk cant be installed on devices
Android App runtime crash after update gradle plugin 3.6
MultiDex problem with Android Studio 3.6 when implementing it the right way
I had developed app on android studio 3.0.1, but I got a error when I installed the apk to my cellphone.
Cellphone connect mac by usb, click run button
,the apk will installed and run no error. But if I copy the apk in finder (like this)
to cellphone and install it in phone, there will be an error "APK parsing error".
If install apk by "adb install xxx.apk" ,when open the app, it will crash and logcat as follow:
12-20 16:35:09.562 14658-14658/? I/art: Late-enabling -Xcheck:jni
12-20 16:35:09.562 14658-14658/? I/art: Reinit property: dalvik.vm.checkjni= false
12-20 16:35:09.614 14658-14658/com.xxx.xxx I/InstantRun: starting instant run server: is main process
12-20 16:35:09.620 14658-14658/com.xxx.xxx E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.xxx.xxx, PID: 14658
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.xxx.xxx/com.xxx.xxx.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.xxx.xxx.MainActivity" on path: DexPathList[[zip file "/data/app/com.xxx.xxx-1/base.apk"],nativeLibraryDirectories=[/data/app/com.xxx.xxx-1/lib/arm64, /data/app/com.xxx.xxx-1/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64, /system/vendor/lib64, /product/lib64]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2695)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2867)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1570)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:6595)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.xxx.xxx.MainActivity" on path: DexPathList[[zip file "/data/app/com.xxx.xxx-1/base.apk"],nativeLibraryDirectories=[/data/app/com.xxx.xxx-1/lib/arm64, /data/app/com.xxx.xxx-1/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64, /system/vendor/lib64, /product/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.Instrumentation.newActivity(Instrumentation.java:1083)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2685)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2867)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1570)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:6595)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832)
12-20 16:35:09.624 14658-14658/com.xxx.xxx I/Process: Sending signal. PID: 14658 SIG: 9
But if click Bulid>Build APK(s) , then copy the apk in same folder (this : apk)to cellphone, it will install and run with no error...
is it a bug in android studio?
manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xxx.xxx">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.CAMERA" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
In new version VS, You shold use "Bulid Apk" menu option to generate the product apk :)
try with disable Instant Run . it find at
Run Goto File -> Settings -> Build,Execution, Deployment -> Instant Run -> Uncheck the checkbox for instant run
before this uninstall previous app from device.
I have just started learning cocos2d-x-3.11.1 in android studio (trying to compile with native C++ language) and I am getting this following error and a message on my phone "Unfortunately libcocos2dx has stopped"
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.granjur.org-1/base.apk"],nativeLibraryDirectories=[/data/app/com.granjur.org-1/lib/arm64, /vendor/lib64, /system/lib64]]] couldn't find "libMyGame.so"
I have configured NDK, SDK and the ANT folders correctly from command line. I've been stuck with this from last two days!
AndroidManifest.xml
<uses-feature android:glEsVersion="0x00020000" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher">
<!-- Tell Cocos2dxActivity the name of our .so -->
<meta-data android:name="android.app.lib_name"
android:value="MyGame" />
<activity
android:name="org.cocos2dx.cpp.AppActivity"
android:screenOrientation="landscape"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
logcat:
06-20 10:58:32.922 15649-15649/com.granjur.org E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.granjur.org, PID: 15649
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.granjur.org-1/base.apk"],nativeLibraryDirectories=[/data/app/com.granjur.org-1/lib/arm64, /vendor/lib64, /system/lib64]]] couldn't find "libMyGame.so"
at java.lang.Runtime.loadLibrary(Runtime.java:367)
at java.lang.System.loadLibrary(System.java:1076)
at org.cocos2dx.lib.Cocos2dxActivity.onLoadNativeLibraries(Cocos2dxActivity.java:246)
at org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:260)
at android.app.Activity.performCreate(Activity.java:6251)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
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:5422)
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)
06-20 10:59:39.226 15649-15649/com.granjur.org I/Process: Sending signal. PID: 15649 SIG: 9
Any help would be highly appreciated!
Thank you!
Run this command at the game directory to compile the source once:
cocos compile -p android --android-studio
Finally I have a genuine solution to the above problem for users working on android studio project of cocos2dx 3.8.1 above.
Just add this line in Application.mk :)
APP_ABI := armeabi-v7a
Sample Application.mk file :
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char
APP_LDFLAGS := -latomic
ifeq ($(NDK_DEBUG),1)
APP_CPPFLAGS += -DCOCOS2D_DEBUG=1
APP_OPTIM := debug
APP_ABI := armeabi-v7a
else
APP_CPPFLAGS += -DNDEBUG
APP_OPTIM := release
APP_ABI := armeabi-v7a
endif
The main problem was the device architecture compatibility with your application. We need to give exclusive support to devices with ARM architecture armeabi-v7a when running proj.android-studio.
Hope this will help many other like me.
I have created a library project as .jar file and try to use it in another project. But I am getting Class not found exception while using it.I added all the activities from the library in my manifest file and its all permission. But still getting same error.
Here is my manifest file
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key" />
<activity android:name=".Activities.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="in.moovo.moovobroker.Activity.Mainactivity"/>
</application>
My error stack trace here :
java.lang.NoClassDefFoundError: Failed resolution of: Lin/moovo/moovobroker/R$layout;
at in.moovo.moovobroker.Activity.Mainactivity.onCreate(Mainactivity.java:85)
at android.app.Activity.performCreate(Activity.java:6072)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2315)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2424)
at android.app.ActivityThread.access$900(ActivityThread.java:155)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1323)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:139)
at android.app.ActivityThread.main(ActivityThread.java:5298)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:950)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745)
Caused by: java.lang.ClassNotFoundException: Didn't find class "in.moovo.moovobroker.R$layout" on path: DexPathList[[zip file "/data/app/in.moovo.moovobrokerappmapview-2/base.apk"],nativeLibraryDirectories=[/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 in.moovo.moovobroker.Activity.Mainactivity.onCreate(Mainactivity.java:85)
at android.app.Activity.performCreate(Activity.java:6072)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2315)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2424)
at android.app.ActivityThread.access$900(ActivityThread.java:155)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1323)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:139)
at android.app.ActivityThread.main(ActivityThread.java:5298)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:950)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745)
Suppressed: java.lang.ClassNotFoundException: in.moovo.moovobroker.R$layout
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)
... 15 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
This error is not for Activity. This is for in/moovo/moovobroker/R$layout which you used into in.moovo.moovobroker.Activity.Mainactivity.
The way you are using is not correct way. When you decide to use jar file, the classes which are into jar, should not have dependency on any external resources.
Correct way is to use aar file. Read how to Create aar file in Android Studio
jar files contain only code! No activities can be found in your jar file. If you wish to use the activity resource files, you should use aar file instead.
Specifically: the 'aar' bundle is the binary distribution of an Android Library Project.
The file extension is .aar, and the maven artifact type should be aar as well, but the file itself a simple zip file with the following entries:
/AndroidManifest.xml (mandatory)
/classes.jar (mandatory)
/res/ (mandatory)
/R.txt (mandatory)
/assets/ (optional)
/libs/*.jar (optional)
/jni/<abi>/*.so (optional)
/proguard.txt (optional)
/lint.jar (optional)
These entries are directly at the root of the zip file.
See also this post for details.
I have a android project built with Eclipse. I can build the APK, but it crashed as the following logs:
E/AndroidRuntime(27898): java.lang.NoClassDefFoundError: Failed resolution of: Lcom/pili/pldroid/streaming/camera/demo/CameraStreamingActivity;
E/AndroidRuntime(27898): at com.example.rtmpdemo.MainActivity$1.onClick(MainActivity.java:35)
E/AndroidRuntime(27898): at android.view.View.performClick(View.java:4757)
E/AndroidRuntime(27898): at android.view.View$PerformClick.run(View.java:19757)
E/AndroidRuntime(27898): at android.os.Handler.handleCallback(Handler.java:739)
E/AndroidRuntime(27898): at android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime(27898): at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime(27898): at android.app.ActivityThread.main(ActivityThread.java:5258)
E/AndroidRuntime(27898): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(27898): at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime(27898): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
E/AndroidRuntime(27898): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)
E/AndroidRuntime(27898): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.pili.pldroid.streaming.camera.demo.CameraStreamingActivity" on path: DexPathList[[zip file "/data/app/com.example.rtmpdemo-1/base.apk"],nativeLibraryDirectories=[/data/app/com.example.rtmpdemo-1/lib/arm, /vendor/lib, /system/lib]]
E/AndroidRuntime(27898): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
E/AndroidRuntime(27898): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
E/AndroidRuntime(27898): at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
E/AndroidRuntime(27898): ... 11 more
E/AndroidRuntime(27898): Suppressed: java.lang.NoClassDefFoundError: com.pili.pldroid.streaming.camera.demo.CameraStreamingActivity
E/AndroidRuntime(27898): at dalvik.system.DexFile.defineClassNative(Native Method)
E/AndroidRuntime(27898): at dalvik.system.DexFile.defineClass(DexFile.java:226)
E/AndroidRuntime(27898): at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
E/AndroidRuntime(27898): at dalvik.system.DexPathList.findClass(DexPathList.java:321)
E/AndroidRuntime(27898): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
E/AndroidRuntime(27898): ... 13 more
E/AndroidRuntime(27898): Suppressed: java.lang.ClassNotFoundException: com.pili.pldroid.streaming.camera.demo.CameraStreamingActivity
E/AndroidRuntime(27898): at java.lang.Class.classForName(Native Method)
E/AndroidRuntime(27898): at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
E/AndroidRuntime(27898): at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
E/AndroidRuntime(27898): at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
E/AndroidRuntime(27898): ... 12 more
E/AndroidRuntime(27898): Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
W/ActivityManager( 810): Force finishing activity com.example.rtmpdemo/.MainActivity
I have defined the CameraStreamingActivity absolutely and registered in the AndroidManifest.xml. The structure of the project like this:
./AndroidManifest.xml
./assets
./libs
./libs/android-support-v4.jar
./libs/armeabi-v7a
./libs/armeabi-v7a/libpldroid_ffmpegbridge.so
./libs/pldroid-camera-streaming-1.2.0.jar
./lint.xml
./proguard-project.txt
./project.properties
./src
./src/com
./src/com/example
./src/com/example/rtmpdemo
./src/com/example/rtmpdemo/MainActivity.java
./src/com/pili
./src/com/pili/pldroid
./src/com/pili/pldroid/streaming
./src/com/pili/pldroid/streaming/camera
./src/com/pili/pldroid/streaming/camera/demo
./src/com/pili/pldroid/streaming/camera/demo/AudioStreamingActivity.java
./src/com/pili/pldroid/streaming/camera/demo/CameraStreamingActivity.java
./src/com/pili/pldroid/streaming/camera/demo/StreamingBaseActivity.java
./src/com/pili/pldroid/streaming/camera/demo/TestActivity.java
The AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.rtmpdemo"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.rtmpdemo.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.pili.pldroid.streaming.camera.demo.CameraStreamingActivity" >
</activity>
<activity
android:name="com.pili.pldroid.streaming.camera.demo.AudioStreamingActivity"
android:label="#string/title_activity_audio_streaming" >
</activity>
<activity android:name="com.pili.pldroid.streaming.camera.demo.TestActivity" >
</activity>
</application>
</manifest>
HOWEVER, it works fine after i import the project into Android Studio.
The import-summary.txt as following:
ECLIPSE ANDROID PROJECT IMPORT SUMMARY
======================================
Ignored Files:
--------------
The following files were *not* copied into the new Gradle project; you
should evaluate whether these are still needed in your project and if
so manually move them:
* .DS_Store
* ic_launcher-web.png
* proguard-project.txt
Replaced Jars with Dependencies:
--------------------------------
The importer recognized the following .jar files as third party
libraries and replaced them with Gradle dependencies instead. This has
the advantage that more explicit version information is known, and the
libraries can be updated automatically. However, it is possible that
the .jar file in your project was of an older version than the
dependency we picked, which could render the project not compileable.
You can disable the jar replacement in the import wizard and try again:
android-support-v4.jar => com.android.support:support-v4:19.1.0
Moved Files:
------------
Android Gradle projects use a different directory structure than ADT
Eclipse projects. Here's how the projects were restructured:
* AndroidManifest.xml => app/src/main/AndroidManifest.xml
* assets/ => app/src/main/assets/
* libs/armeabi-v7a/libpldroid_ffmpegbridge.so => app/src/main/jniLibs/armeabi-v7a/libpldroid_ffmpegbridge.so
* libs/pldroid-camera-streaming-1.2.0.jar => app/libs/pldroid-camera-streaming-1.2.0.jar
* lint.xml => app/lint.xml
* res/ => app/src/main/res/
* src/ => app/src/main/java/
Next Steps:
-----------
You can now build the project. The Gradle project needs network
connectivity to download dependencies.
Bugs:
-----
If for some reason your project does not build, and you determine that
it is due to a bug or limitation of the Eclipse to Gradle importer,
please file a bug at http://b.android.com with category
Component-Tools.
(This import summary is for your information only, and can be deleted
after import once you are satisfied with the results.)
What did i miss?
Thanks.
Actually, your code don't have any problem. And this is the runtime error.
I sure that root cause is coming from libs which you import by wrong way.
"./libs/pldroid-camera-streaming-1.2.0.jar"
Try to remove this lib and import again by other way such as:
way 1: Java build path-> Libraries -> Add External JARS..
way 2: manual copy this lib directly to ".libs/" folder