Application crashes only on Android 5.0 using VerifyError

My application works fine in every version except 5.0. In this version, every action that has a packet passing it discards some data.

Here is logcat:

05-09 01:37:43.733 6371-6371/com.pttest.com.pockettankstips E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.pttest.com.pockettankstips, PID: 6371
java.lang.VerifyError: Rejecting class com.pttest.com.pockettankstips.compare because it failed compile-time verification (declaration of 'com.pttest.com.pockettankstips.compare' appears in /data/data/com.pttest.com.pockettankstips/files/instant-run/dex/slice-slice_9-classes.dex)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.Class.newInstance(Class.java:1572)
at android.app.Instrumentation.newActivity(Instrumentation.java:1065)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2199)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
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:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

Here is my code to open Activity:

Intent co = new Intent("com.pttest.com.pockettankstips.compare");
Bundle compare = new Bundle();
compare.putString("index", "3 Shot");
co.putExtras(compare);
startActivity(co);
Toast.makeText(getBaseContext(), "Select Second Weapon to Compare!", Toast.LENGTH_LONG).show();
break;

And how do I get the Bundle in an Activity that I am going to open.

c1 = (Spinner) findViewById(R.id.cspin1);
c2 = (Spinner) findViewById(R.id.cspin2);
c1.setAdapter(new MyAdapter(this, R.layout.spinada, weapon));
c2.setAdapter(new MyAdapter1(this, R.layout.spinada, weapon1));
c1.setOnItemSelectedListener(this);
c2.setOnItemSelectedListener(this);
Bundle compare = getIntent().getExtras();
String compone = compare.getString("index", "3 Shot");
String[] weaponone = getResources().getStringArray(R.array.weapalpha);
x = Arrays.asList(weaponone).indexOf(compone);
c1.setSelection(x);

In the actions where I try to send intto the Bundle, it works fine, but when I try to send String, it will work.

+4
source share
2 answers

I have an error for my previous project, as shown below, and I am solving the answer.

java.lang.VerifyError:      com.harshad.syncV4.android.module.ModuleTest,       (      'com.harshad.syncV4.android.module.ModuleTest'      /data/app/com.harshad.syncV4.android-1/base.apk)

:

Android 5.0.1.

:

.

try {
   synchronized (this) {
      this.wait(100);
   }
} catch (InterruptedException e) {
   /* Exception message can be captured here */
}

try/catch

try/catch - . , Android OS 5.0.1 . , ART.

:

synchronized (this) {
   try {
      this.wait(testActionItem.getDelay());
   } catch (InterruptedException e) {
      /* Exception message can be captured here */
   }
}
+1

:

String compone = compare.getString("index");

String compone = compare.getString("index", "3 Shot");

, .

, .

+1

All Articles