Cannot start activity on Android through Unity -
i'm using unity create android application.
i have 2 plugins. each works fine on own, when want both of them used cannot switch activities between them.
i have spent past ten days reading similar question , have tried decompiling/editing/recompiling java code doing unity itself, no luck.
here final code have written, , errors get.
my androidmanifest.xml
file:
... <activity android:name="com.company.game.rrandroidpluginactivity" android:label="my game"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.browsable" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name="com.codiwans.iab.iab" android:screenorientation="landscape" android:configchanges="fontscale|keyboard|keyboardhidden|locale|mnc|mcc|navigation|orientation|screenlayout|screensize|smallestscreensize|uimode|touchscreen" android:label="my game iab" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.browsable" /> </intent-filter> </activity> ...
here unity code (in c#):
androidjavaclass jc = new androidjavaclass("com.unity3d.player.unityplayer"); androidjavaobject jo = jc.getstatic<androidjavaobject>("currentactivity"); androidjavaobject pm = jo.call<androidjavaobject>("getpackagemanager"); androidjavaobject intent = pm.call<androidjavaobject>("getlaunchintentforpackage", "com.codiwans.iab.iab"); jo.call("startactivity", intent);
here error get:
jni: unable find method id 'getclass' filename: ./runtime/exportgenerated/androidmanaged/unityenginedebug.cpp line: 54) jni: unable find method id 'getname' filename: ./runtime/exportgenerated/androidmanaged/unityenginedebug.cpp line: 54) jni: unable find method id 'getname' filename: ./runtime/exportgenerated/androidmanaged/unityenginedebug.cpp line: 54) caused by: java.lang.noclassdeffounderror: com/unity3d/player/unityplayer$12 @ com.unity3d.player.unityplayer.setscreensize(unknown source) @ com.unity3d.player.unityplayer.nativerender(native method) @ com.unity3d.player.unityplayer.ondrawframe(unknown source) @ android.opengl.glsurfaceview$glthread.guardedrun(glsurfaceview.java:1462) @ android.opengl.glsurfaceview$glthread.run(glsurfaceview.java:1216) caused by: java.lang.nullpointerexception @ android.app.instrumentation.execstartactivity(instrumentation.java:1382) @ android.app.activity.startactivityforresult(activity.java:3190) @ android.app.activity.startactivity(activity.java:3297) ... 4 more
both activities main. 1 of them launcher.
i can call methods on both.
i can't switch activity non-launcher one, however, getting error specified (unable find id 'getclass').
i feel close, yet far. appreciated. going crazy on here!
thanks.
your real problem this: java.lang.noclassdeffounderror: com/unity3d/player/unityplayer$12
for whatever reason java not finding class in class path. research elsewhere showed may related mismatch in jar you're compiling against , version you're developing against. don't have jar in correct place, or version you're using doesn't provide class.
i hope @ least helps point in right direction.
Comments
Post a Comment