I am facing this issue in Junit. I have created an Android application that refers the Library project.
I have written an Android Test Project that runs on the Android application project.
I get the following error while running the test cases:
java.lang.NullPointerException
at com.jayway.android.robotium.solo.ViewFetcher.getNonDecorViews(ViewFetcher.java:188)
at com.jayway.android.robotium.solo.ViewFetcher.getAllViews(ViewFetcher.java:112)
at com.jayway.android.robotium.solo.Waiter.clickableItemsExist(Waiter.java:164)
at com.jayway.android.robotium.solo.Waiter.waitForClickableItems(Waiter.java:150)
at com.jayway.android.robotium.solo.Solo.clickOnView(Solo.java:787)
at com.mycompany.myproject.test.LoginActivityInstrumentation.enterSessionPin(LoginActivityInstrumentation.java:149)
com.mycompany.myproject.test.LoginActivityTest.testEnterButtonCase1(LoginActivityTest.java:174)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)
at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)
at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:186)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:537)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1551)
Can anyone help ?
It got fixed after updating robotium.jar to 3.2.1
Related
I think my issue is because of Cloudfirestore that I am using inside my application. Some devices crash and some not.( S7 samsung verizon android 8.0 crashed, A5 samsung android 6.0 did not crash...). I used logcat to get the logs that are causing the crash and this is the error:
java.lang.RuntimeException: Internal error in Firestore (0.6.6-dev).
at com.google.firebase.firestore.obfuscated.zzgf.zzb(com.google.firebase:firebase-firestore##17.1.1:377)
at com.google.firebase.firestore.obfuscated.zzgk.run(com.google.firebase:firebase-firestore##17.1.1)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5302)
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.RuntimeException: io.grpc.ManagedChannelProvider$ProviderNotFoundException: No functional channel service provider found. Try adding a dependency on the grpc-okhttp or grpc-netty artifact
at com.google.firebase.firestore.obfuscated.zzgf.zza(com.google.firebase:firebase-firestore##17.1.1:288)
at com.google.firebase.firestore.obfuscated.zzgi.run(com.google.firebase:firebase-firestore##17.1.1)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
at java.util.concurrent.FutureTask.run(FutureTask.java:234)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:153)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:267)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
at com.google.firebase.firestore.obfuscated.zzgf$zza.run(com.google.firebase:firebase-firestore##17.1.1:203)
at java.lang.Thread.run(Thread.java:856)
Caused by: io.grpc.ManagedChannelProvider$ProviderNotFoundException: No functional channel service provider found. Try adding a dependency on the grpc-okhttp or grpc-netty artifact
at io.grpc.ManagedChannelProvider.provider(ManagedChannelProvider.java:60)
at io.grpc.ManagedChannelBuilder.forTarget(ManagedChannelBuilder.java:70)
at com.google.firebase.firestore.obfuscated.zzfk.<init>(com.google.firebase:firebase-firestore##17.1.1:101)
at com.google.firebase.firestore.obfuscated.zzm.zza(com.google.firebase:firebase-firestore##17.1.1:1216)
at com.google.firebase.firestore.obfuscated.zzt.run(com.google.firebase:firebase-firestore##17.1.1)
at com.google.firebase.firestore.obfuscated.zzgf.zzc(com.google.firebase:firebase-firestore##17.1.1:309)
at com.google.firebase.firestore.obfuscated.zzgj.call(com.google.firebase:firebase-firestore##17.1.1)
at com.google.firebase.firestore.obfuscated.zzgf.zza(com.google.firebase:firebase-firestore##17.1.1:285)
at com.google.firebase.firestore.obfuscated.zzgi.run(com.google.firebase:firebase-firestore##17.1.1)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
at java.util.concurrent.FutureTask.run(FutureTask.java:234)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:153)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:267)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
at com.google.firebase.firestore.obfuscated.zzgf$zza.run(com.google.firebase:firebase-firestore##17.1.1:203)
at java.lang.Thread.run(Thread.java:856)
so how to resolve such an error in flutter ??
Had the same issue with some phones like Samsung S5. The app started crashing when I tried to open it. Here is a fix that worked for me:
defaultConfig {
...
multiDexEnabled true
ndk {
abiFilters 'x86', 'armeabi-v7a'
}
}
Had to add ndk in android/app/build.gradle file and it worked like a charm.
I hope this can help someone.
you should check first if you have installed the latest cloud_firestore package (0.8.2+3) in your pubspec.yaml
you can upgrade the google services under <yourapp>/android/build.gradle (current version 4.2.0). But be aware that you maybe need to upgrade the other plugins as well to the newest version there.
My android app is more than a year on Play now and everything was OK.
About 2 weeks ago users started complaining on crashes. Than was strange cause I haven't changed anything for some time now.
Yesterday, after finally taking a look on crash logs, I've noticed huge number NoClassDefFoundError being thrown, which led to crashes in the app.
3 strange things:
1) GameplayFragment$TimerUpdater is of course present.
1) The app has not been updated for months.
2) Apparently only GINGERBREAD versions crash
Has anybody experienced this?
Thanks
[main] java.lang.NoClassDefFoundError: com.ivygames.morskoiboi.ui.GameplayFragment$TimerUpdater at
com.ivygames.morskoiboi.ui.GameplayFragment.startTimer(GameplayFragment.java:336) at
com.ivygames.morskoiboi.ui.GameplayFragment.access$10(GameplayFragment.java:333) at
com.ivygames.morskoiboi.ui.GameplayFragment$UiProxy$1.run(GameplayFragment.java:495) at
android.os.Handler.handleCallback(Handler.java:587) at
android.os.Handler.dispatchMessage(Handler.java:92) at
android.os.Looper.loop(Looper.java:130) at
android.app.ActivityThread.main(ActivityThread.java:3691) at
java.lang.reflect.Method.invokeNative(Native Method) at
java.lang.reflect.Method.invoke(Method.java:507) at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912) at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:670) at
dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.ClassNotFoundException: com.ivygames.morskoiboi.ui.GameplayFragment$TimerUpdater in loader dalvik.system.PathClassLoader[/data/app/com.ivygames.morskoiboi-1.apk] at
dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240) at
java.lang.ClassLoader.loadClass(ClassLoader.java:551) at
java.lang.ClassLoader.loadClass(ClassLoader.java:511) ... 12 more (BOARD=codina; BOOTLOADER=unknown; BRAND=samsung; CPU_ABI=armeabi-v7a; DEVICE=GT-I8160; DISPLAY=GINGERBREAD.XXLL2; HARDWARE=samsung; HOST=DELL205; ID=GINGERBREAD; MANUFACTURER=samsung; MODEL=GT-I8160; PRODUCT=GT-I8160; USER=dpi; SDK=10)
Please see minimum sdk version required you can set it to lower android version i.e 7 or 8
Trying to do a partial mock of an activity using Mockito.spy after its instrumented on the Android VM (Emulator 4.1). Here is the error I get
java.lang.VirtualMachineError
at dalvik.system.DexFile.defineClass(Native Method)
at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:207)
at dalvik.system.DexFile.loadClass(DexFile.java:196)
at dalvik.system.DexClassLoader.findClass(DexClassLoader.java:226)
at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at com.google.dexmaker.stock.ProxyBuilder.loadClass(ProxyBuilder.java:272)
at com.google.dexmaker.stock.ProxyBuilder.buildProxyClass(ProxyBuilder.java:254)
at com.google.dexmaker.mockito.DexmakerMockMaker.createMock(DexmakerMockMaker.java:54)
at org.mockito.internal.util.MockUtil.createMock(MockUtil.java:26)
at org.mockito.internal.MockitoCore.mock(MockitoCore.java:49)
at org.mockito.Mockito.spy(Mockito.java:1324)
at com.company.droid.helper.ActivitySandbox.setupActivity(ActivitySandbox.java:21)
at com.company.droid.ui.fragment.signup.SignupFragmentTest.setUp(SignupFragmentTest.java:50)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:529)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1448)
I've tried changing VMs, Mockito versions, Dexmaker versions but nothing seems to work. Any ideas?
Seems to be a bug in Dalvik, which is not being avoided by DexMaker.
See this bug report and vote for it if you want.
https://code.google.com/p/dexmaker/issues/detail?id=9
I have a strange issue.I developed an android application with scan functionality.I reused some zxing code code for the scanning section. My app is working fine for all the device and emulater too.But after I uploaded it in market I am getting error on scan portion.My error report is
java.lang.IllegalStateException: Could not execute method of the activity
at android.view.View$1.onClick(View.java:2191)
at android.view.View.performClick(View.java:2532)
at android.view.View$PerformClick.run(View.java:9291)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:4293)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
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:507)
at android.view.View$1.onClick(View.java:2186)
... 11 more
Caused by: java.lang.ExceptionInInitializerError
at com.imotiva.Menu1.points(Menu1.java:46)
... 14 more
Caused by: java.lang.NoClassDefFoundError: com.qr.decoding.ResultMetadataType
at com.qr.scanning.CaptureActivity.<clinit>(CaptureActivity.java:92)
... 15 more
Still my code code is working in device but the same app in the market don't. Please help me friends...
At last I found the solution for my problem.gtumca-MAC's solution Android update 17 seems incompatible with external Jars worked for me.Created one folder named libs and add my core.jar .Now it's working fine.Thanks all.
I have followed the below steps to test my app.
I have created Android Project.
I have created the debug signature for my sample app and test app(which need to be tested)
Place the sampleapp_debug.apk in the bin folder (where my workspace is there)
Installed the testapp_debug.apk in the emulator.
Now i am running the project as a Android JunitTest.
I am getting the below error.. How to resolve this..
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.NullPointerException: Method name must not be null.
at java.lang.ClassCache.findMethodByName(ClassCache.java:297)
at java.lang.Class.getMethod(Class.java:985)
at android.test.suitebuilder.TestMethod.getAnnotation(TestMethod.java:60)
at android.test.suitebuilder.annotation.HasMethodAnnotation.apply(HasMethodAnnotation.java:39)
at android.test.suitebuilder.annotation.HasMethodAnnotation.apply(HasMethodAnnotation.java:30)
at com.android.internal.util.Predicates$OrPredicate.apply(Predicates.java:106)
at android.test.suitebuilder.annotation.HasAnnotation.apply(HasAnnotation.java:42)
at android.test.suitebuilder.annotation.HasAnnotation.apply(HasAnnotation.java:31)
at com.android.internal.util.Predicates$NotPredicate.apply(Predicates.java:122)
at android.test.suitebuilder.TestSuiteBuilder.satisfiesAllPredicates(TestSuiteBuilder.java:254)
at android.test.suitebuilder.TestSuiteBuilder.build(TestSuiteBuilder.java:190)
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)
I faced similar type of problem before. I resolved the same by using default constructor in Testcode rather than parametrized constructor. The following tutorial was useful for me
See this tutorial
I encounter the same error and this solution worked for me:
Do not use public TestTextView(String name) but public TestTextView()
as constructor.
as what W.Elsinga mention on his comment found here Link
Your referenced code was way old.
Just add default constructor.
public StartActivityTest() {
super(StartActivity.class);
}
I think the problem at method: android.test.suitebuilder.TestMethod.getAnnotation().
Try to call the method setName() at constructor of the activity.
See: RuntimeException while using ActivityUnitTestCase, but not while ActivityInstrumentationTestCase2
The exception is caused by android.test.suitebuilder.TestMethod.getAnnotation(), too.