How to resolve java.lang.VerifyError in android - android

I am getting VerifyError for method calling of paticular class Utility ,first it was working properly and suddenly its started giving run time error, it is working fine with API lollipop and higher API , Here is my error logs.
06-08 12:25:07.655: E/AndroidRuntime(18117): FATAL EXCEPTION: main
06-08 12:25:07.655: E/AndroidRuntime(18117): java.lang.VerifyError: com/package/projectname/utility/Utility
06-08 12:25:07.655: E/AndroidRuntime(18117): at com.package.projectname.AppDelegate.onCreate(AppDelegate.java:36)
06-08 12:25:07.655: E/AndroidRuntime(18117): at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1017)
06-08 12:25:07.655: E/AndroidRuntime(18117): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4575)
06-08 12:25:07.655: E/AndroidRuntime(18117): at android.app.ActivityThread.access$1400(ActivityThread.java:153)
06-08 12:25:07.655: E/AndroidRuntime(18117): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1346)
06-08 12:25:07.655: E/AndroidRuntime(18117): at android.os.Handler.dispatchMessage(Handler.java:99)
06-08 12:25:07.655: E/AndroidRuntime(18117): at android.os.Looper.loop(Looper.java:176)
06-08 12:25:07.655: E/AndroidRuntime(18117): at android.app.ActivityThread.main(ActivityThread.java:5302)
06-08 12:25:07.655: E/AndroidRuntime(18117): at java.lang.reflect.Method.invokeNative(Native Method)
06-08 12:25:07.655: E/AndroidRuntime(18117): at java.lang.reflect.Method.invoke(Method.java:511)
06-08 12:25:07.655: E/AndroidRuntime(18117): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
06-08 12:25:07.655: E/AndroidRuntime(18117): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
06-08 12:25:07.655: E/AndroidRuntime(18117): at dalvik.system.NativeStart.main(Native Method)

I solved this error by placing gms library separately:
Before I have used :
compile 'com.google.android.gms:play-services:8.1.0'
That above one line will take care of GCM and all google related libaries.But this one line cause a verifier error.On top of the verifier error you can see some gms related log.
After that I have added separately like this to fix this issue :
compile 'com.google.android.gms:play-services-location:8.1.0'
compile 'com.google.android.gms:play-services-base:8.1.0'
compile 'com.google.android.gms:play-services-analytics:8.1.0'
compile 'com.google.android.gms:play-services-maps:8.1.0'
compile "com.google.android.gms:play-services-gcm:8.1.0' // for gcm push notification
and also Check this

Related

NoClassDefFoundError: com.google.firebase.FirebaseOptions (firebase and admob)

I am in troubled because:
java.lang.NoClassDefFoundError: com.google.firebase.FirebaseOptions
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1214)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1189)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:4912)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4518)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4458)
at android.app.ActivityThread.access$1300(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1319)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5136)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
This generally happens when you are using google play-service dependency in your project.
Just downgrade the google play-service dependency to compile 'com.google.android.gms:play-services:8.3.0' and the problem may get solved.

Crashlytics NoClassDefFoundError: com.crashlytics.android.answers.Answers

I get a project from other developer to fix minor issues in app, when I'm running my app on device I'm getting an error:
15142-15142/com.etripconcept E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.crashlytics.android.answers.Answers
at com.crashlytics.android.Crashlytics.<init>(Crashlytics.java:224)
at com.crashlytics.android.Crashlytics.<init>(Crashlytics.java:207)
at com.crashlytics.android.Crashlytics.<init>(Crashlytics.java:202)
at com.etripconcept.SplashScreenActivity.onCreate(SplashScreenActivity.java:16)
at android.app.Activity.performCreate(Activity.java:5163)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2061)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2122)
at android.app.ActivityThread.access$600(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1228)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4895)
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:994)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)
at dalvik.system.NativeStart.main(Native Method)
I'm new in Android development, so it may be stupid question, but Google doesn't say anything about it. I use Android Studio 1.2.2 on Win 8.1

RenderScript Support Library crashes on x86 devices

I'm getting FATAL EXCEPTION running android.support.v8.renderscript.* on Razor i, a x86 device. The problem goes away if I use android.renderscript.* Also there is not problem with ARM devices. Here is the exception:
03-03 18:35:26.009 25011-25011/com.example.app E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.app/com.example.app.MainActivity}: android.support.v8.renderscript.RSRuntimeException: Error loading RS jni library: java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1306]: 143 cannot locate '__strlen_chk'...
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2115)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2153)
at android.app.ActivityThread.access$700(ActivityThread.java:137)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5031)
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:792)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.support.v8.renderscript.RSRuntimeException: Error loading RS jni library: java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1306]: 143 cannot locate '__strlen_chk'...
at android.support.v8.renderscript.RenderScript.create(RenderScript.java:945)
at android.support.v8.renderscript.RenderScript.create(RenderScript.java:982)
at android.support.v8.renderscript.RenderScript.create(RenderScript.java:968)
at com.example.app.MainActivity$PlaceholderFragment.createScript(MainActivity.java:92)
at com.example.app.MainActivity$PlaceholderFragment.onCreateView(MainActivity.java:81)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:829)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1035)
at android.app.BackStackRecord.run(BackStackRecord.java:635)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1397)
at android.app.Activity.performStart(Activity.java:5067)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2088)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2153)
            at android.app.ActivityThread.access$700(ActivityThread.java:137)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:5031)
            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:792)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555)
            at dalvik.system.NativeStart.main(Native Method)
I meet the same issue when I using Build Tools 21.1.1 and proguard, you may need to use the following proguard settings:
-keepclasseswithmembernames class * {
native <methods>;
}
-keep class android.support.v8.renderscript.** { *; }
For more infomation: Using the Android Renderscript v8 Support Library
With Build Tools 21.1.1 this issue disappear.
I think you should also include the native libraries from \build-tools\19.0.2\renderscript\lib\packaged

Call Web Service in Android application

I want to call .net web service into Android application. For that I am using running web service available on net called
"www.w3schools.com/webservices/tempconvert.asmx"
It's running successfully with browser, but when I call it in my Android application it gives me error in my tab device. The log cat info is shown below:
06-08 17:27:16.351: E/dalvikvm(5767): Could not find class 'org.ksoap2.serialization.SoapObject', referenced from method com.example.wscallingapk.WS_MainActivity.onCreate
06-08 17:27:22.612: E/AndroidRuntime(5767): FATAL EXCEPTION: main
06-08 17:27:22.612: E/AndroidRuntime(5767): java.lang.NoClassDefFoundError: org.ksoap2.serialization.SoapObject
06-08 17:27:22.612: E/AndroidRuntime(5767): at com.example.wscallingapk.WS_MainActivity.onCreate(WS_MainActivity.java:37)
06-08 17:27:22.612: E/AndroidRuntime(5767): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
06-08 17:27:22.612: E/AndroidRuntime(5767): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
06-08 17:27:22.612: E/AndroidRuntime(5767): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
06-08 17:27:22.612: E/AndroidRuntime(5767): at android.os.Handler.dispatchMessage(Handler.java:99)
06-08 17:27:22.612: E/AndroidRuntime(5767): at android.os.Looper.loop(Looper.java:123)
06-08 17:27:22.612: E/AndroidRuntime(5767): at android.app.ActivityThread.main(ActivityThread.java:4627)
06-08 17:27:22.612: E/AndroidRuntime(5767): at java.lang.reflect.Method.invokeNative(Native Method)
06-08 17:27:22.612: E/AndroidRuntime(5767): at java.lang.reflect.Method.invoke(Method.java:521)
06-08 17:27:22.612: E/AndroidRuntime(5767): at java.lang.reflect.Method.invoke(Method.java:521)
06-08 17:27:22.612: E/AndroidRuntime(5767): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:871)
06-08 17:27:22.612: E/AndroidRuntime(5767): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
06-08 17:27:22.612: E/AndroidRuntime(5767): at dalvik.system.NativeStart.main(Native Method)
ksoap2-android-assembly-2.6.2-jar-with-dependencies.jar
Download this library from this Link
and put it into your lib folder of your project.

How should i use a jar library in my android layout?

I make the jar library in my code successfully, but in my xml file it calls
06-08 18:55:23.715: E/AndroidRuntime(13218): java.lang.RuntimeException: Unable to start activity ComponentInfo: android.view.InflateException: Binary XML file line #6: Error inflating class android.jar.com.jjoe64.graphview.BarGraphView
exception.
And the jar file is here github-jjoe64/GraphView
06-08 19:46:22.023: E/AndroidRuntime(19764): FATAL EXCEPTION: main
06-08 19:46:22.023: E/AndroidRuntime(19764): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.zxl.Timetable/com.zxl.Timetable.ui.CurriculumAllInfo}: android.view.InflateException: Binary XML file line #6: Error inflating class com.jjoe64.graphview.BarGraphView
06-08 19:46:22.023: E/AndroidRuntime(19764): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2307)
06-08 19:46:22.023: E/AndroidRuntime(19764): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2357)
06-08 19:46:22.023: E/AndroidRuntime(19764): at android.app.ActivityThread.access$600(ActivityThread.java:153)
06-08 19:46:22.023: E/AndroidRuntime(19764): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
06-08 19:46:22.023: E/AndroidRuntime(19764): at android.os.Handler.dispatchMessage(Handler.java:99)
06-08 19:46:22.023: E/AndroidRuntime(19764): at android.os.Looper.loop(Looper.java:137)
06-08 19:46:22.023: E/AndroidRuntime(19764): at android.app.ActivityThread.main(ActivityThread.java:5226)
06-08 19:46:22.023: E/AndroidRuntime(19764): at java.lang.reflect.Method.invokeNative(Native Method)
06-08 19:46:22.023: E/AndroidRuntime(19764): at java.lang.reflect.Method.invoke(Method.java:511)
06-08 19:46:22.023: E/AndroidRuntime(19764): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
06-08 19:46:22.023: E/AndroidRuntime(19764): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
06-08 19:46:22.023: E/AndroidRuntime(19764): at dalvik.system.NativeStart.main(Native Method)
06-08 19:46:22.023: E/AndroidRuntime(19764): Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class com.jjoe64.graphview.BarGraphView
06-08 19:46:22.023: E/AndroidRuntime(19764): at android.view.LayoutInflater.createView(LayoutInflater.java:596)
06-08 19:46:22.023: E/AndroidRuntime(19764): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
06-08 19:46:22.023: E/AndroidRuntime(19764): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
06-08 19:46:22.023: E/AndroidRuntime(19764): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
06-08 19:46:22.023: E/AndroidRuntime(19764): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
06-08 19:46:22.023: E/AndroidRuntime(19764): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
06-08 19:46:22.023: E/AndroidRuntime(19764): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
06-08 19:46:22.023: E/AndroidRuntime(19764): at android.app.Activity.setContentView(Activity.java:1881)
06-08 19:46:22.023: E/AndroidRuntime(19764): at com.zxl.Timetable.ui.CurriculumAllInfo.onCreate(CurriculumAllInfo.java:39)
06-08 19:46:22.023: E/AndroidRuntime(19764): at android.app.Activity.performCreate(Activity.java:5104)
06-08 19:46:22.023: E/AndroidRuntime(19764): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
06-08 19:46:22.023: E/AndroidRuntime(19764): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2261)
06-08 19:46:22.023: E/AndroidRuntime(19764): ... 11 more
06-08 19:46:22.023: E/AndroidRuntime(19764): Caused by: java.lang.NoSuchMethodException: <init> [class android.content.Context, interface android.util.AttributeSet]
06-08 19:46:22.023: E/AndroidRuntime(19764): at java.lang.Class.getConstructorOrMethod(Class.java:460)
06-08 19:46:22.023: E/AndroidRuntime(19764): at java.lang.Class.getConstructor(Class.java:431)
06-08 19:46:22.023: E/AndroidRuntime(19764): at android.view.LayoutInflater.createView(LayoutInflater.java:561)
06-08 19:46:22.023: E/AndroidRuntime(19764): ... 22 more
#jjoe64
create a folder
libs
in your project and add that jar file in it
Right Click that jar file
-->Build path-->Add to Build Path
The View that you are trying to use in the layout file needs to implement the two-parameter constructor that takes a Context and an AttributeSet, as that is the constructor used by the layout inflater. Your View does not, and hence it cannot be used in a layout XML resource.

Categories

Resources