java - GCM Plugin for Unity, Could not find method GCMRegistrar.checkDevice -


i've seen posts before, none of solutions seem have worked me.

i downloaded/installed eclipse mobile(http://www.eclipse.org/downloads/packages/eclipse-mobile-developers/junosr2), , created android application, using instructions found guy's video tutorial(http://www.youtube.com/watch?v=tazeiionva0) make library can drop unity.

of course, tutorial mobclix, trying build gcm plugin, process similar. think have included dependencies need. in eclipse, in project see "android dependencies" includes: classes.jar(contains unity player hooks), gcm.jar , android-support-v4.jar. under "android 4.2.2" see "android.jar". under "referenced libraries" see classes.jar , gcm.jar. following other forum posts(such one: gcm : java.lang.noclassdeffounderror: com.google.android.gcm.gcmregistrar) error had manually copied gcm.jar , classes.jar "libs" folder(i using adt 17), selected add build path.

after of this, still see 2 errors when deploy test on device, first title error, followed noclassdeffounderror. i've gone through 3 devices compatibility, , i'm using motorola 2.3.3 on it(so should support gcm). if knows else causing please let me know. not familiar eclipse(or java matter), i'm betting it's in java project somehow.

my manifest:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installlocation="preferexternal" package="com.my.package.testapp" android:versionname="1.0" android:versioncode="1">      <uses-sdk android:minsdkversion="8" android:targetsdkversion="17" />      <supports-screens         android:smallscreens="true"         android:normalscreens="true"         android:largescreens="true"         android:xlargescreens="true"         android:anydensity="true"     />      <application android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="false">          <activity android:name="com.unity3d.player.unityplayerproxyactivity" android:label="@string/app_name" android:configchanges="fontscale|keyboard|keyboardhidden|locale|mnc|mcc|navigation|orientation|screenlayout|screensize|smallestscreensize|uimode|touchscreen" android:screenorientation="portrait">             <intent-filter>                 <action android:name="android.intent.action.main" />                 <category android:name="android.intent.category.launcher" />             </intent-filter>              <intent-filter>                 <action android:name="android.intent.action.view" />                 <category android:name="android.intent.category.default" />                 <category android:name="android.intent.category.browsable" />                 <data android:scheme="my_test_scheme" android:host="*" />             </intent-filter>         </activity>          <activity             android:name="com.unity3d.player.unityplayeractivity"             android:label="@string/app_name"             android:configchanges="fontscale|keyboard|keyboardhidden|locale|mnc|mcc|navigation|orientation|screenlayout|screensize|smallestscreensize|uimode|touchscreen"             android:screenorientation="portrait"         />          <activity android:name="com.unity3d.player.unityplayernativeactivity" android:label="@string/app_name" android:configchanges="fontscale|keyboard|keyboardhidden|locale|mnc|mcc|navigation|orientation|screenlayout|screensize|smallestscreensize|uimode|touchscreen" android:screenorientation="portrait">             <meta-data android:name="android.app.lib_name" android:value="unity" />             <meta-data android:name="unityplayer.forwardnativeeventstodalvik" android:value="false" />         </activity>          <activity             android:name="com.unity3d.player.videoplayer"             android:label="@string/app_name"             android:screenorientation="behind"             android:configchanges="fontscale|keyboard|keyboardhidden|locale|mnc|mcc|navigation|orientation|screenlayout|screensize|smallestscreensize|uimode|touchscreen"         />          <receiver             android:name="com.google.android.gcm.gcmbroadcastreceiver"             android:permission="com.google.android.c2dm.permission.send" >             <intent-filter>                 <action android:name="com.google.android.c2dm.intent.receive" />                 <action android:name="com.google.android.c2dm.intent.registration" />                 <category android:name="com.my.package.testapp" />             </intent-filter>         </receiver>          <service android:name="com.my_provider.gcm.gcmintentservice" />     </application>      <uses-feature android:glesversion="0x00020000" />      <uses-permission android:name="com.my.package.testapp.permission.c2d_message" />         <uses-permission android:name="android.permission.internet" />     <uses-permission android:name="android.permission.get_accounts" />     <uses-permission android:name="android.permission.wake_lock" />     <uses-permission android:name="com.google.android.c2dm.permission.receive" />      <permission         android:name="com.my.package.testapp.permission.c2d_message"         android:protectionlevel="signature"     />  </manifest> 

my logcat:

i/unity   (16312): myapplication::myapplication() i/unity   (16312):  i/unity   (16312):   i/unity   (16312): (filename: ./runtime/exportgenerated/androidmanaged/unityenginedebug.cpp line: 43) i/unity   (16312):  d/dalvikvm(16344): gc_concurrent freed 1309k, 55% free 3034k/6727k, external 1625k/2137k, paused 2ms+3ms d/dalvikvm(16344): gc_concurrent freed 539k, 54% free 3137k/6727k, external 1625k/2137k, paused 2ms+2ms d/deviceprofile(16344): ************************** properties **************************** d/deviceprofile(16344): * android.vm.dexfile: true d/deviceprofile(16344): * file.encoding: utf-8 d/deviceprofile(16344): * file.separator: / d/deviceprofile(16344): * http.agent: dalvik/1.4.0 (linux; u; android 2.3.4; lg-p999 build/grj22) d/deviceprofile(16344): * java.boot.class.path: /system/framework/core.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/core-junit.jar d/deviceprofile(16344): * java.class.path: . d/deviceprofile(16344): * java.class.version: 46.0 d/deviceprofile(16344): * java.compiler:  d/deviceprofile(16344): * java.ext.dirs:  d/deviceprofile(16344): * java.home: /system d/deviceprofile(16344): * java.io.tmpdir: /sdcard d/deviceprofile(16344): * java.library.path: /vendor/lib:/system/lib d/deviceprofile(16344): * java.net.preferipv6addresses: true d/deviceprofile(16344): * java.runtime.name: android runtime d/deviceprofile(16344): * java.runtime.version: 0.9 d/deviceprofile(16344): * java.specification.name: dalvik core library d/deviceprofile(16344): * java.specification.vendor: android project d/deviceprofile(16344): * java.specification.version: 0.9 d/deviceprofile(16344): * java.vendor: android project d/deviceprofile(16344): * java.vendor.url: http://www.android.com/ d/deviceprofile(16344): * java.version: 0 d/deviceprofile(16344): * java.vm.name: dalvik d/deviceprofile(16344): * java.vm.specification.name: dalvik virtual machine specification d/deviceprofile(16344): * java.vm.specification.vendor: android project d/deviceprofile(16344): * java.vm.specification.version: 0.9 d/deviceprofile(16344): * java.vm.vendor: android project d/deviceprofile(16344): * java.vm.vendor.url: http://www.android.com/ d/deviceprofile(16344): * java.vm.version: 1.4.0 d/deviceprofile(16344): * javax.net.ssl.truststore: /system/etc/security/cacerts.bks d/deviceprofile(16344): * line.separator:  d/deviceprofile(16344): * mngspkphone: true d/deviceprofile(16344): * os.arch: armv7l d/deviceprofile(16344): * os.name: linux d/deviceprofile(16344): * os.version: 2.6.32.9 d/deviceprofile(16344): * path.separator: : d/deviceprofile(16344): * recording.auto-focus: true d/deviceprofile(16344): * recording.ffc.camera-sensor: 1 d/deviceprofile(16344): * recording.ffc.video: 320x240 15 low d/deviceprofile(16344): * recording.hd.video: 1280x720 24 hd d/deviceprofile(16344): * recording.live.audio-aux: ehaaaa== d/deviceprofile(16344): * recording.live.video: 176x144 15 low d/deviceprofile(16344): * recording.live.video-aux: aukahv/haahnqoaelacxmqeabgjopia= d/deviceprofile(16344): * recording.live.video-aux-rotation-90: aukahv/haahnqoaelacrcqeabgjopia= d/deviceprofile(16344): * recording.liveffc.audio-aux: ehaaaa== d/deviceprofile(16344): * recording.liveffc.camera-sensor: 1 d/deviceprofile(16344): * recording.liveffc.video: 176x144 15 low d/deviceprofile(16344): * recording.liveffc.video-aux: aukahv/haahnqoaelacxmqeabgjopia= d/deviceprofile(16344): * recording.liveffc.video-aux-rotation-90: aukahv/haahnqoaelacrcqeabgjopia= d/deviceprofile(16344): * recording.normal.video: 640x480 15 medium d/deviceprofile(16344): * user.dir: / d/deviceprofile(16344): * user.home:  d/deviceprofile(16344): * user.language: en d/deviceprofile(16344): * user.name:  d/deviceprofile(16344): * user.region: d/deviceprofile(16344): ****************************************************************** i/activitymanager( 1111): no longer want com.google.android.gsf.login (pid 15960): hidden #16 i/dalvikvm(16312): not find method com.google.android.gcm.gcmregistrar.checkdevice, referenced method com.my_provider.gcm.registeractivity.registerdevice w/dalvikvm(16312): vfy: unable resolve static method 382: lcom/google/android/gcm/gcmregistrar;.checkdevice (landroid/content/context;)v d/dalvikvm(16312): vfy: replacing opcode 0x71 @ 0x0000 d/dalvikvm(16312): vfy: dead code 0x0003-001c in lcom/my_provider/gcm/registeractivity;.registerdevice (landroid/app/activity;)v w/unity   (16312): font size , style overrides supported dynamic fonts. w/unity   (16312):   w/unity   (16312): (filename: ./runtime/gui/textmeshgenerator2.cpp line: 65) w/unity   (16312):  w/unity   (16312): font size , style overrides supported dynamic fonts. w/unity   (16312):   w/unity   (16312): (filename: ./runtime/gui/textmeshgenerator2.cpp line: 65) w/unity   (16312):  w/dalvikvm(16312): threadid=9: thread exiting uncaught exception (group=0x4001d560) e/androidruntime(16312): fatal exception: glthread 10 e/androidruntime(16312): java.lang.noclassdeffounderror: com.google.android.gcm.gcmregistrar e/androidruntime(16312):    @ com.my_provider.gcm.registeractivity.registerdevice(registeractivity.java:23) e/androidruntime(16312):    @ com.unity3d.player.unityplayer.nativerender(native method) e/androidruntime(16312):    @ com.unity3d.player.unityplayer.ondrawframe(unknown source) e/androidruntime(16312):    @ android.opengl.glsurfaceview$glthread.guardedrun(glsurfaceview.java:1363) e/androidruntime(16312):    @ android.opengl.glsurfaceview$glthread.run(glsurfaceview.java:1118) w/activitymanager( 1111):   force finishing activity com.my.package.testapp/com.unity3d.player.unityplayernativeactivity 

the code simple 2 files

registeractivity.java:

package com.my_provider.gcm;  import android.os.bundle; import android.app.activity; import com.google.android.gcm.gcmregistrar; import com.unity3d.player.unityplayer; import com.unity3d.player.unityplayeractivity;  public class registeractivity extends unityplayeractivity {     public static string projectid;      @override     protected void oncreate(bundle savedinstancestate)     {         super.oncreate(savedinstancestate);     }      public static void registerdevice(final activity activity)     {         try         {             gcmregistrar.checkdevice(activity);             gcmregistrar.checkmanifest(activity);              final string regid = gcmregistrar.getregistrationid(activity);              if (regid.equals(""))                 gcmregistrar.register(activity, projectid);         }         catch(exception e)         {             unityplayer.unitysendmessage("errorhandlergameobject", "onerror", e.getmessage());         }     } } 

and lastly service gcmbroadcastreceiver.java:

package com.my_provider.gcm; import android.content.context; import android.content.intent;  import com.google.android.gcm.gcmbaseintentservice; import com.unity3d.player.unityplayer;  public class gcmbroadcastreceiver extends gcmbaseintentservice {      public gcmbroadcastreceiver()     {         super(registeractivity.projectid);     }      @override     protected void onregistered(context context, string deviceid)     {         unityplayer.unitysendmessage("deviceregisteringgameobject", "onregisteredandroiddevice", deviceid);     }      @override     protected void onunregistered(context context, string deviceid)     {         unityplayer.unitysendmessage("deviceregisteringgameobject", "onunregisteredandroiddevice", deviceid);     }      @override     public void onerror(context context, string errorid)     {         unityplayer.unitysendmessage("deviceregisteringgameobject", "onerror", errorid);     }      @override     protected void onmessage(context context, intent intent)     {         unityplayer.unitysendmessage("deviceregisteringgameobject", "onmessageandroid", intent.getstringextra("message"));     } } 

i had manually copied gcm.jar , classes.jar "libs" folder(i using adt 17), selected add build path.

i have no idea classes.jar is.

simply having gcm.jar in libs/ folder sufficient regular android app -- manually changing build path "add build path" mistake.

whether process unity plugin different, cannot say.

the error indicates have gcm.jar in compile-time build path (e.g., via add build path) not in apk (e.g., not have gcm.jar in libs/, or adding build path manually prevented being added apk).


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

keyboard - C++ GetAsyncKeyState alternative -

android - java.net.UnknownHostException(Unable to resolve host “URL”: No address associated with hostname) -