Every time I start my Android instrumentation test it fails with
android.test.suitebuilder.TestSuiteBuilder$FailedToCreateTests:
Error in testSuiteConstructionFailed:
java.lang.RuntimeException: Exception during suite construction
at android.test.suitebuilder.TestSuiteBuilder$FailedToCreateTests.testSuiteConstructionFailed(TestSuiteBuilder.java:239)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:520)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1447)
Caused by: java.lang.reflect.InvocationTargetException
at com.samy4me.test.Test_Service2.<init>(Test_Service2.java:26)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
at android.test.suitebuilder.TestMethod.instantiateTest(TestMethod.java:87)
at android.test.suitebuilder.TestMethod.createTest(TestMethod.java:73)
at android.test.suitebuilder.TestSuiteBuilder.addTest(TestSuiteBuilder.java:263)
at android.test.suitebuilder.TestSuiteBuilder.build(TestSuiteBuilder.java:185)
at android.test.InstrumentationTestRunner.onCreate(InstrumentationTestRunner.java:373)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4218)
at android.app.ActivityThread.access$3000(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2071)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoClassDefFoundError: com.XXX.ws.Service
... 19 more
The class is there. I checked ProGuard, I temporarily deactivated ProGuard. I reduced the test to the absolute minimum:
public class Test_Service2
extends android.test.ServiceTestCase<Service>
{
public Test_Service2 ()
{
super (Service.class);
} // Test_Service2
} // Test_Service2
Has anybody got an idea how this might have come about?
Looking closer I now found the following:
04-23 15:56:21.186 W/ClassPathPackageInfoSource( 580): Caused by: java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation
04-23 15:56:21.186 W/ClassPathPackageInfoSource( 580): at dalvik.system.DexFile.defineClass(Native Method)
04-23 15:56:21.186 W/ClassPathPackageInfoSource( 580): at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:209)
04-23 15:56:21.186 W/ClassPathPackageInfoSource( 580): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:203)
04-23 15:56:21.186 W/ClassPathPackageInfoSource( 580): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
04-23 15:56:21.186 W/ClassPathPackageInfoSource( 580): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
04-23 15:56:21.186 W/ClassPathPackageInfoSource( 580): ... 26 more
This is part of the original error exception chain but was truncated. The pre-verified exception is not new and yet another pain in Android development.
OK, I found the problem - mostly PEBKAC. So here it is:
I have looked only at the console. But there the error message was truncated. Lesson learned: always check logcat as well.
The real error was the well know pre-verified error which happens when libraries meant for the main application get dragged into test application. Lesson learned: always make sure that libraries are not dragged into the instrumentation test
If you use Maven — like I do — then you can read the details up here Automate Android Test Project, which — for added embarrassment — I wrote myself two weeks ago.
The test is correct and should work.
Be sure that Service and Service.class refer to com.XXX.ws.Service and not android.app.Service.
Related
I have an issue with AWS Amplify for Android. I am using Cognito and S3, both configured though Amplify. When I init my app it crashes for API level lower than 21. If I run it with API level 21 or higher, it runs successfully. This is the exception:
07-28 22:02:08.693 5105-5105/com.marcast.sistmovildonatto.debug E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com/amazonaws/mobile/client/AWSMobileClient
at com.amplifyframework.auth.cognito.AWSCognitoAuthPlugin.<init>(AWSCognitoAuthPlugin.java:103)
at com.marcast.sistmovildonatto.DidonatoApplication.onCreate(DidonatoApplication.kt:16)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:999)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4151)
at android.app.ActivityThread.access$1300(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1255)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: com.amazonaws.mobile.client.AWSMobileClient
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at com.amplifyframework.auth.cognito.AWSCognitoAuthPlugin.<init>(AWSCognitoAuthPlugin.java:103)
at com.marcast.sistmovildonatto.DidonatoApplication.onCreate(DidonatoApplication.kt:16)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:999)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4151)
at android.app.ActivityThread.access$1300(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1255)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
I am using guest authentication with Cognito, and S3 with public access to objects. The crash occurs here:
class DidonatoApplication: Application() {
override fun onCreate() {
super.onCreate()
try {
Amplify.addPlugin(AWSCognitoAuthPlugin()) //HERE throws exception
Amplify.addPlugin(AWSS3StoragePlugin())
Amplify.configure(applicationContext)
Log.i("DidonatoMobile", "Initialized Amplify")
} catch (error: AmplifyException) {
Log.e("DidonatoMobile", "Could not initialize Amplify", error)
}
}
}
Any one have an idea what could be the problem?
I had a similar problem, but a different class definition that couldn't be found.
I noticed that my implementations for the various Amplify plugins in the build.gradle file used different versions. Matching the versions fixed the errors (in my case I went with my lowest version - 1.0.0).
I'm building LatinIME source code provided by google-source in android-studio but i got a bug in ProximityInfo.java line 89 which show a dialog and i have added a jni_latinime.so
in src/main/jniLibs
.
But the bug is still not fixed.What mistake i did and what should i have to do now?
Error
droid.inputmethod.latin E/JniUtils: Could not load native library jni_latinime
java.lang.UnsatisfiedLinkError: unknown failure
at java.lang.Runtime.loadLibrary(Runtime.java:370)
at java.lang.System.loadLibrary(System.java:535)
at com.android.inputmethod.latin.utils.JniUtils.<clinit>(JniUtils.java:28)
at com.android.inputmethod.latin.LatinIME.<clinit>(LatinIME.java:546)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1319)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2406)
at android.app.ActivityThread.access$1700(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1326)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4944)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
at dalvik.system.NativeStart.main(Native Method)
05-28 21:58:48.483 1642-1957/system_process E/InputMethodManagerService: checkCscDefaultIme : mCscDefaultImePackageName is wrong
05-28 21:58:48.493 1642-1957/system_process E/InputMethodManagerService: checkCscDefaultIme : mCscDefaultImePackageName is wrong
05-28 21:58:48.834 12819-12819/com.android.inputmethod.latin E/dalvikvm: Could not find class 'android.os.UserManager', referenced from method com.android.inputmethod.compat.UserManagerCompatUtils.<clinit>
05-28 21:58:48.844 12819-12819/com.android.inputmethod.latin E/dalvikvm: Could not find class 'android.os.UserManager', referenced from method com.android.inputmethod.compat.UserManagerCompatUtils.getUserLockState
05-28 21:58:48.954 12819-12819/com.android.inputmethod.latin E/AndroidRuntime: FATAL EXCEPTION: main
android.view.InflateException: Binary XML file line #2: Error inflating class com.android.inputmethod.keyboard.emoji.EmojiPalettesView
at android.view.LayoutInflater.createView(LayoutInflater.java:619)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:693)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:818)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:742)
at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at com.android.inputmethod.keyboard.KeyboardSwitcher.onCreateInputView(KeyboardSwitcher.java:464)
at com.android.inputmethod.latin.LatinIME.onCreateInputView(LatinIME.java:752)
at android.inputmethodservice.InputMethodService.updateInputViewShown(InputMethodService.java:1227)
at android.inputmethodservice.InputMethodService.showWindowInner(InputMethodService.java:1628)
at android.inputmethodservice.InputMethodService.showWindow(InputMethodService.java:1595)
at android.inputmethodservice.InputMethodService$InputMethodImpl.showSoftInput(InputMethodService.java:521)
at android.inputmethodservice.IInputMethodWrapper.executeMessage(IInputMethodWrapper.java:192)
at com.android.internal.os.HandlerCaller$MyHandler.handleMessage(HandlerCaller.java:61)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4944)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:593)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:693)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:818)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:742)
at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at com.android.inputmethod.keyboard.KeyboardSwitcher.onCreateInputView(KeyboardSwitcher.java:464)
at com.android.inputmethod.latin.LatinIME.onCreateInputView(LatinIME.java:752)
at android.inputmethodservice.InputMethodService.updateInputViewShown(InputMethodService.java:1227)
at android.inputmethodservice.InputMethodService.showWindowInner(InputMethodService.java:1628)
at android.inputmethodservice.InputMethodService.showWindow(InputMethodService.java:1595)
at android.inputmethodservice.InputMethodService$InputMethodImpl.showSoftInput(InputMethodService.java:521)
at android.inputmethodservice.IInputMethodWrapper.executeMessage(IInputMethodWrapper.java:192)
at com.android.internal.os.HandlerCaller$MyHandler.handleMessage(HandlerCaller.java:61)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4944)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.UnsatisfiedLinkError: Native method not found: com.android.inputmethod.keyboard.ProximityInfo.setProximityInfoNative:(IIIIII[II[I[I[I[I[I[F[F[F)J
at com.android.inputmethod.keyboard.ProximityInfo.setProximityInfoNative(Native Method)
at com.android.inputmethod.keyboard.ProximityInfo.createNativeProximityInfo(ProximityInfo.java:222)
at com.android.inputmethod.keyboard.ProximityInfo.<init>(ProximityInfo.java:81)
at com.android.inputmethod.keyboard.Keyboard.<init>(Keyboard.java:123)
at com.android.inputmethod.keyboard.internal.KeyboardBuilder.build(KeyboardBuilder.java:196)
at com.android.inputmethod.keyboard.KeyboardLayoutSet.getKeyboard(KeyboardLayoutSet.java:232)
at com.android.inputmethod.keyboard.KeyboardLayoutSet.getKeyboard(KeyboardLayoutSet.java:204)
at com.android.inputmethod.keyboard.emoji.EmojiCategory.getKeyboard(EmojiCategory.java:374)
at com.android.inputmethod.keyboard.emoji.EmojiCategory.addShownCategoryId(EmojiCategory.java:223)
at com.android.inputmethod.keyboard.emoji.EmojiCategory.<init>(EmojiCategory.java:176)
at com.android.inputmethod.keyboard.emoji.EmojiPalettesView.<init>(EmojiPalettesView.java:120)
at com.android.inputmethod.keyboard.emoji.EmojiPalettesView.<init>(EmojiPalettesView.java:96)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:593)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:693)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:818)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:742)
at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at com.android.inputmethod.keyboard.KeyboardSwitcher.onCreateInputView(KeyboardSwitcher.java:464)
at com.android.inputmethod.latin.LatinIME.onCreateInputView(LatinIME.java:752)
at android.inputmethodservice.InputMethodService.updateInputViewShown(InputMethodService.java:1227)
at android.inputmethodservice.InputMethodService.showWindowInner(InputMethodService.java:1628)
at android.inputmethodservice.InputMethodService.showWindow(InputMethodService.java:1595)
at android.inputmethodservice.InputMethodService$InputMethodImpl.showSoftInput(InputMethodService.java:521)
at android.inputmethodservice.IInputMethodWrapper.executeMessage(IInputMethodWrapper.java:192)
at com.android.internal.os.HandlerCaller$MyHandler.handleMessage(HandlerCaller.java:61)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4944)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
at dalvik.system.NativeStart.main(Native Method)
Your screenshot suggests that your jniLibs contains a jar file with prebuilt native library. I did not know that this is even possible, but yes, it works in Android Studio 2.3 and higher. Nice!
Anyways, as I explained elsewhere, don't expect Android Studio to resolve magically the native method declarations into a prebuilt library (even if it is unpacked into src/main/jnLibs).
You can simply ignore this error message: your APK will still install the prebuilt library, and the native method will be resolved at run time.
You can add #SuppressWarnings("JniMissingFunction") annotation for this method, or for the entire class:
#SuppressWarnings("JniMissingFunction")
public class ProximityInfo {
or configure this kind of Lint inspections for the given project, or for all projects:
This is very old query and hopefully must have been solved by now. But still wanted to put my comment on this.
As I can see this is a run time error and related to "UnsatisfiedLinkError", which means that the application is unable to link to the library that it is looking for. Hence the library "latimime" is missing when the application is bundled.
To make sure that the library is bundled along with the application, you can extract the APK and check.
I use version of Android Studio 1.5.1
If I create new project and MainActivity extends AppCompatActivity then it does not work it gives error like:
12-02 11:55:20.736 29178-29214/? E/dalvikvm: Could not find class 'android.app.AppOpsManager', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zza
12-02 11:55:45.099 29225-29225/? E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.poonam.demoappcompatactivity/com.example.poonam.demoappcompatactivity.MainActivity}: java.lang.IllegalStateException: This app has been built with an incorrect configuration. Please configure your build for VectorDrawableCompat.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2077)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2104)
at android.app.ActivityThread.access$600(ActivityThread.java:134)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4624)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalStateException: This app has been built with an incorrect configuration. Please configure your build for VectorDrawableCompat.
at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:726)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:193)
at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:81)
at android.support.v7.app.AppCompatDelegateImplBase.<init>(AppCompatDelegateImplBase.java:127)
at android.support.v7.app.AppCompatDelegateImplV9.<init>(AppCompatDelegateImplV9.java:147)
at android.support.v7.app.AppCompatDelegateImplV11.<init>(AppCompatDelegateImplV11.java:27)
at android.support.v7.app.AppCompatDelegateImplV14.<init>(AppCompatDelegateImplV14.java:53)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:205)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:185)
at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:525)
at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:74)
at com.example.poonam.demoappcompatactivity.MainActivity.onCreate(MainActivity.java:10)
at android.app.Activity.performCreate(Activity.java:4479)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1050)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2041)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2104)
at android.app.ActivityThread.access$600(ActivityThread.java:134)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4624)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
at dalvik.system.NativeStart.main(Native Method)
12-02 11:55:48.855 233-4816/? E/CellLocation: create GsmCellLocation
I create new project. Not change anything only run it.but it gives error.
How can i use AppCompatActivity.
Your logcat throws
This app has been built with an incorrect configuration.
You should use latest gradle plagin version
classpath 'com.android.tools.build:gradle:2.2.2' //2.2.0
Here is Demo
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
FYI
You can add this in your build.gradle section .
android {
defaultConfig {
vectorDrawables.useSupportLibrary = true
}
}
Then Clean-Rebuild, Sync & Run.
My Xamarin Android app is already in production, people are downloading it from Google play and everything seems to be fine, except from time to time I get following errors in Google Play Developer Console :
java.lang.RuntimeException: Unable to instantiate application mono.android.app.Application: java.lang.ClassNotFoundException: Didn't find class "mono.android.app.Application" on path: DexPathList[[],nativeLibraryDirectories=[/vendor/lib, /system/lib, /vendor/lib]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:559)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5119)
at android.app.ActivityThread.access$1500(ActivityThread.java:156)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1418)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5867)
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:858)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:674)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "mono.android.app.Application" on path: DexPathList[[],nativeLibraryDirectories=[/vendor/lib, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.app.Instrumentation.newApplication(Instrumentation.java:982)
at android.app.LoadedApk.makeApplication(LoadedApk.java:550)
... 11 more
or similar but slightly different version:
java.lang.RuntimeException: Unable to instantiate application mono.android.app.Application: java.lang.ClassNotFoundException: Didn't find class "mono.android.app.Application" on path: /mnt/asec/myapp-1/pkg.apk
at android.app.LoadedApk.makeApplication(LoadedApk.java:504)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4563)
at android.app.ActivityThread.access$1400(ActivityThread.java:157)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1349)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5317)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "mono.android.app.Application" on path: /mnt/asec/myapp-1/pkg.apk
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newApplication(Instrumentation.java:985)
at android.app.LoadedApk.makeApplication(LoadedApk.java:499)
... 11 more
I've got zero google results for ClassNotFoundException + mono.android.app.Application. According to Developer console it comes from android 4.2 and 4.4., different devices (HTC, Samsung..), even from devices which i tested and everything works (HTC One).
Any ideas? Is this bug in mono? or Xamarin? Or am I doing something wrong?
Whenever xamarin app install in the device it is find to mono runtime support lib, if it is not installed in the device then it will stop to run so, if u have run without mono installation you can change some settings on:
Property => Android Option
Go to Packaging and select only one Bundle assemblies into native code, and also go to linker and select linking is None then run it.
I hope it might work.
My app crashes on LG devices when I am clicking the ad (from admob)!. What's the problem?
android.view.InflateException: Binary XML file line #21: Error inflating class <unknown> at
android.view.LayoutInflater.createView(LayoutInflater.java:613) at
com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) at
android.view.LayoutInflater.onCreateView(LayoutInflater.java:660) at
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685) at
android.view.LayoutInflater.inflate(LayoutInflater.java:466) at
android.view.LayoutInflater.inflate(LayoutInflater.java:396) at
android.view.LayoutInflater.inflate(LayoutInflater.java:352) at
com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:3090) at
com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3150) at
com.android.internal.policy.impl.PhoneWindow.getDecorView(PhoneWindow.java:1737) at
android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2683) at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2124) at
android.app.ActivityThread.access$600(ActivityThread.java:138) at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1204) at
android.os.Handler.dispatchMessage(Handler.java:99) at
android.os.Looper.loop(Looper.java:137) at
android.app.ActivityThread.main(ActivityThread.java:4952) at
java.lang.reflect.Method.invokeNative(Native Method) at
java.lang.reflect.Method.invoke(Method.java:511) at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794) at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:561) at
dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException at
java.lang.reflect.Constructor.constructNative(Native Method) at
java.lang.reflect.Constructor.newInstance(Constructor.java:417) at
android.view.LayoutInflater.createView(LayoutInflater.java:587) ... 21 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: length=7; index=-1 at
android.view.View.<init>(View.java:3638) at
android.view.ViewGroup.<init>(ViewGroup.java:427) at
android.widget.LinearLayout.<init>(LinearLayout.java:176) at
android.widget.LinearLayout.<init>(LinearLayout.java:172) ... 24 more
..................................................................................................
It's issue with LG Optimus L9 P760 device. It occurs only on version 4.1.2, I see it every now and then in my apps. If your application is available on any store and it's serious problem to you remember that you can always disable this device from supported devices.
I don't think there's anything to worry about. In my case the layout isn't complicated so the solution proposed by #Kishan with flattening view hierarchy will not work. It's just manufacturer fault.
This same error was there in my previous application. its because of the internal memory stack of the device (Some thing like RAM) is full. so for overcoming this error see the hierarchy of layout. and see the time of inflating in the hierarchy view if android eclipse IDE. and decrease the hierarchy of the layout. i have solved my issue with this. so you can check this if you can solve by the same solution.
Hope you can understand this solution.