简体   繁体   中英

AdnEngine error from the play store: java.lang.NoSuchMethodError

I'm getting the following back from Android PLay errors. The game was tested on the emulator, and my own real device (note 2) never got this error when making it.

What have I done wrong?

Exception class java.lang.NoSuchMethodError
Source method BaseActivity.onSetContentView()

and the stack

java.lang.NoSuchMethodError: com.google.ads.AdView.setRotation
at net.mindzone.trafficchaos.BaseActivity.onSetContentView(BaseActivity.java:81)
at org.andengine.ui.activity.BaseGameActivity.onCreate(BaseGameActivity.java:85)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3687)
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:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
at dalvik.system.NativeStart.main(Native Method)

EDIT For other people who want the answer, it was half of what jcw said. It is indeed a method which doesn't exists on a lower API. (in this case setRotation from the view, which is only available in api 13 and higher.) Though because I was calling it in the onSetContentView() it gave that as an error in google play.

Solution was: Putting the method inside a TRY ...CATCH... block and reverting back to oldskool transform of the view in case it failed. Now google play is not gibing me any user errors anymore.

I got this error recently too. It occurs when your app contains a method that is not availibe for all devices(because of api level). You will have to remove those methods and replace them with depreciated methods.

There is a better way to do this, but I could not get it to work, here is a link to the page, just modify the answer to fit your method - getSize() giving me errors

Alternatively, because I am not sure what your problem is, you could try downloading a new version of the ad mob SDK from their website.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM