Note that there are some explanatory texts on larger screens.

plurals
  1. POverifyerror with AspectJ's private method on android platform
    primarykey
    data
    text
    <p>I met an odd problem related with AspectJ's advice. When I declare the function(below <strong>private void gotNetType2()</strong> ) as a private member function called by an around advice, when starting the apk, it failed with below error. </p> <pre><code>11-04 12:31:56.742: W/dalvikvm(2229): VFY: invoke type does not match method type of Lcom/bright/net/test/NetType2;.gotNetType2 11-04 12:31:56.742: W/dalvikvm(2229): VFY: rejecting opcode 0x6e at 0x0000 11-04 12:31:56.743: W/dalvikvm(2229): VFY: rejected Lcom/xxx/net/test/NetType2;.ajc$inlineAccessMethod$com_xxx_net_test_NetType2$com_xxx_net_test_NetType2$gotNetType2 (Lcom/xxx/net/test/NetType2;)V 11-04 12:31:56.743: W/dalvikvm(2229): Verifier rejected class Lcom/xxx/net/test/NetType2; .... .... 11-04 12:31:56.863: E/AndroidRuntime(2229): FATAL EXCEPTION: main 11-04 12:31:56.863: E/AndroidRuntime(2229): java.lang.VerifyError: com/xxx/net/test/NetType2 11-04 12:31:56.863: E/AndroidRuntime(2229): at com.xxx.main.MainActivity.onCreate(MainActivity.java:1) 11-04 12:31:56.863: E/AndroidRuntime(2229): at android.app.Activity.performCreate(Activity.java:5206) 11-04 12:31:56.863: E/AndroidRuntime(2229): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1081) 11-04 12:31:56.863: E/AndroidRuntime(2229): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2297) 11-04 12:31:56.863: E/AndroidRuntime(2229): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2385) 11-04 12:31:56.863: E/AndroidRuntime(2229): at android.app.ActivityThread.access$600(ActivityThread.java:157) 11-04 12:31:56.863: E/AndroidRuntime(2229): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1341) 11-04 12:31:56.863: E/AndroidRuntime(2229): at android.os.Handler.dispatchMessage(Handler.java:99) 11-04 12:31:56.863: E/AndroidRuntime(2229): at android.os.Looper.loop(Looper.java:153) 11-04 12:31:56.863: E/AndroidRuntime(2229): at android.app.ActivityThread.main(ActivityThread.java:5326) 11-04 12:31:56.863: E/AndroidRuntime(2229): at java.lang.reflect.Method.invokeNative(Native Method) 11-04 12:31:56.863: E/AndroidRuntime(2229): at java.lang.reflect.Method.invoke(Method.java:511) 11-04 12:31:56.863: E/AndroidRuntime(2229): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:848) 11-04 12:31:56.863: E/AndroidRuntime(2229): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:615) 11-04 12:31:56.863: E/AndroidRuntime(2229): at dalvik.system.NativeStart.main(Native Method) </code></pre> <p>But after I changed the function to a public one( <strong>public void gotNetType2()</strong> ), the error disappeared. I have tried to switch the sdk from 1.7 to 1.6 and also tried to build the target apk version as 4.1 as the same as my android phone. But the error still exists.</p> <p>I got no idea why only private function failed. Any suggestions? Thanks a lot.</p> <p>below is the aspectj code for your reference, which is very simple.</p> <pre><code>public aspect NetType2 { public final static String TAG = "NetTypeAspectJ"; pointcut testMainActivity():execution(* com.xxx.main.MainActivity.onCreate(..)); void around():testMainActivity() { proceed(); gotNetType2(); } private void gotNetType2() { Log.e(TAG, "hahaha...."); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload