- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我之前看过有关此问题的帖子,但似乎没有一个解决方案对我有用。
我下载/安装了 Eclipse for Mobile( http://www.eclipse.org/downloads/packages/eclipse-mobile-developers/junosr2 ),并创建了一个 Android 应用程序,然后使用从这个人的视频教程 ( http://www.youtube.com/watch?v=TazEIIoNVA0 ) 中找到的说明将其设为库,以便我可以将其放入 Unity 中。
当然,他的教程是针对Mobclix的,我正在尝试构建一个GCM插件,但过程是相似的。我想我已经包含了我需要的所有依赖项。在 Eclipse 中,在项目中我看到“Android 依赖项”,其中包括:classes.jar(包含 Unity 播放器 Hook )、gcm.jar 和 android-support-v4.jar。在“Android 4.2.2”下我看到“android.jar”。在“引用库”下,我看到classes.jar 和gcm.jar。在关于此错误的其他论坛帖子(例如: GCM : java.lang.noclassdeffounderror: com.google.android.gcm.GCMRegistrar )之后,我手动将 gcm.jar 和classes.jar 复制到“libs”文件夹(我使用的是 ADT 17),然后选择“添加到构建路径”。
完成所有这些后,当我在设备上部署测试时,我仍然看到 2 个错误,第一个是标题错误,其次是 NoClassDefFoundError。我已经测试了 3 种设备的兼容性,目前我使用的是 2.3.3 的 Motorola(所以它应该支持 GCM)。如果有人知道还有什么可能导致此问题,请告诉我。我对 Eclipse(甚至 Java)不太熟悉,所以我打赌它以某种方式存在于 Java 项目中。
我的 list :
<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>
我的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: The Android Project
D/DeviceProfile(16344): * java.specification.version: 0.9
D/DeviceProfile(16344): * java.vendor: The 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: The Android Project
D/DeviceProfile(16344): * java.vm.specification.version: 0.9
D/DeviceProfile(16344): * java.vm.vendor: The 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: US
D/DeviceProfile(16344): ******************************************************************
I/ActivityManager( 1111): No longer want com.google.android.gsf.login (pid 15960): hidden #16
I/dalvikvm(16312): Could not find method com.google.android.gcm.GCMRegistrar.checkDevice, referenced from method com.my_provider.gcm.RegisterActivity.RegisterDevice
W/dalvikvm(16312): VFY: unable to resolve static method 382: Lcom/google/android/gcm/GCMRegistrar;.checkDevice (Landroid/content/Context;)V
D/dalvikvm(16312): VFY: replacing opcode 0x71 at 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 and style overrides are only supported for dynamic fonts.
W/Unity (16312):
W/Unity (16312): (Filename: ./Runtime/GUI/TextMeshGenerator2.cpp Line: 65)
W/Unity (16312):
W/Unity (16312): Font size and style overrides are only supported for 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 with 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): at com.my_provider.gcm.RegisterActivity.RegisterDevice(RegisterActivity.java:23)
E/AndroidRuntime(16312): at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
E/AndroidRuntime(16312): at com.unity3d.player.UnityPlayer.onDrawFrame(Unknown Source)
E/AndroidRuntime(16312): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1363)
E/AndroidRuntime(16312): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118)
W/ActivityManager( 1111): Force finishing activity com.my.package.testapp/com.unity3d.player.UnityPlayerNativeActivity
代码很简单,只有两个文件
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());
}
}
}
最后是服务 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 and classes.jar to the "libs" folder(I am using ADT 17), then selected to Add To Build Path.
我不知道classes.jar
是什么。
对于常规 Android 应用程序来说,只需在 libs/
文件夹中包含 gcm.jar
就足够了 - 使用“添加到构建路径”手动更改构建路径是一个简单的方法错误。
Unity 插件的流程是否不同,我不能说。
该错误表明您的编译时构建路径中有 gcm.jar
(例如,通过“添加到构建路径”),但它不在 APK 中(例如,您没有 gcm.jar
位于 libs/
中,或者手动将其添加到构建路径会阻止将其添加到您的 APK)。
关于java - Unity 的 GCM 插件,找不到方法 GCMRegistrar.checkDevice,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16548842/
我在互联网上搜索了很多小时,但没有找到满意的结果,所以 -VSTO Addin 和 COM Addin(我们作为类库项目制作并使用 Excel 对象)之间有什么区别?VSTO 项目是否有任何限制,例如
我在互联网上搜索了很多小时,但没有找到满意的结果,所以 -VSTO Addin 和 COM Addin(我们作为类库项目制作并使用 Excel 对象)之间有什么区别?VSTO 项目是否有任何限制,例如
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于 Stack Overflow 来说是偏离主题的,
我正在寻找有关如何构建可扩展 WCF 服务器(具有动态加载的服务)的建议,最好使用 System.Addins 或 MEF。 服务器应托管实现最小“插件”API(StartService/StopSe
有没有一种方法可以使用加载浏览器扩展/插件/插件的 headless 浏览器(即 PhantomJS、Selenium)来运行自动测试? 更具体地说,我想模拟广告拦截器(如 Ghostery、ad-b
我是 gradle 的新手,我使用 artifactory 作为我的 repo 服务器。我在网上查看了如何将我的项目发布到我的 repo 服务器,发现我可以使用 maven-publish 或使用 a
我想禁用某些状态的点击/事件,并仅使少数状态可点击。我通读了http://newsignature.github.io/us-map/处的文档,并且找不到与此问题相关的任何内容。 最佳答案 http:
据我了解,在Intellij中使用idea插件打开Maven构建的项目并不是最好的方法,即调用: mvn idea:idea 但是直接打开pom文件(Intellij有默认的Maven插件);同样的事
使用Artifactory plugin对于 Jenkins pipeline 来说是一种幸福,只要遵循文档就可以了。但后来我介绍了Maven Flatten plugin解析父模块和子模块 mvn
我已经安装了Elasticsearch版本1.7.1。一切正常。我也安装了 JDBC 驱动程序。检查下面我的插件文件夹 目录E:\Xampp\htdocs\my-elastic\elasticsear
在我使用 webpack common chunks 插件创建包含第三方库(如 angular、react、lodash 等)的 vendor 包之前,但后来我知道了 webpack dll
我们正在尝试使用(Jenkins、sonar、eclipse ...)安装 CI 平台。 为了让每个开发人员都可以在提交之前对他的代码进行分析,我想知道两种选择: 使用 Sonar 插件运行本地分析。
我知道这是一个比较特殊的问题。尽管如此,也许有些人知道这一点: 我想在 Eclipse 中使用 Maven 编译 Hector=> 分支:0.7.0 和标签:hector-0.7.0-29(https
我卡住了。我一直在尝试寻找或自己创建一个简单的准系统示例,说明如何为 VS 2010 Express 创建 Outlook 插件。我知道这在 VS 2010 Pro 中更简单,但是,在快速版本中真的不
我有以下排除过滤器来忽略所有 R 文件类: findbugs-exclude-filter.xml 当我将它用于 FindBugs-IDEA 插件时,它可以
我刚开始玩 CakePHP,我发现了 Wildflower CMS .我喜欢这个想法,并打算开始修补它。不过,我有一个问题。 在自述文件中,我发现了以下内容:“Wildflower 不是也不会是 Ca
虽然现在大部分情况都是使用n-api来编写插件,但是底层毕竟是v8(和libuv),使用v8编写简单的插件,同时熟悉v8的使用。 本文介绍在写c++插件时,简单又常用的写法,其实本质上,写插件
本篇是 Python 系列教程第 3 篇,更多内容敬请访问我的 Python 合集 Visual Studio Code的安装非常简单,就不放这里增加文章篇幅了。 相比PyCharm,V
Maven – 插件 什么是 Maven 插件? Maven 实际上是一个依赖插件执行的框架,每个任务实际上是由插件完成。Maven 插件通常被用来: 创建 jar 文件 创建 war
我正在编写一个插件来添加带有标签 [deposit_page] 的页面;该标记应替换为一些 PHP 代码。 这就是我所拥有的,但它不起作用。有什么我遗漏或做错了什么吗? function deposi
我是一名优秀的程序员,十分优秀!