亚马逊设备消息存根Android Studio

我正在尝试将Amazon Device Messaging与 Android Studio集成.首先我跟着( integrating-your-app-with-adm).当我打电话
ADM adm = new ADM(getActivity());
if (adm.isSupported()) {
    // ...
}

logcat上有这样的输出

E/AndroidRuntime(24472): java.lang.RuntimeException: Stub!

E/AndroidRuntime(24472): at com.amazon.device.messaging.ADM.(UnkNown Source)

所以我跟着亚马逊(Integrating Amazon Libraries with Android Studio),结果相同.

然后我试过thisthis没有成功.

我的AndroidManifest.xml如下所示:

...
<uses-permission android:name="de.mypackage.permission.RECEIVE_ADM_MESSAGE" />
<uses-permission android:name="com.amazon.device.messaging.permission.RECEIVE" />
<permission android:name=".permission.RECEIVE_ADM_MESSAGE" android:protectionLevel="signature" />
...
<application
    android:name=".MyPackageApplication"
    android:allowBackup="true"
    android:allowClearUserData="true"
    android:hardwareAccelerated="false"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme">
...
    <service android:name=".service.ADMNotificationService" android:exported="false" />

    <amazon:enable-feature android:name="com.amazon.device.messaging" android:required="true" />

    <receiver android:name=".service.ADMNotificationService$MessageAlertReceiver"
        android:permission="com.amazon.device.messaging.permission.SEND">
    <intent-filter>
            <action android:name="com.amazon.device.messaging.intent.REGISTRATION" />
            <action android:name="com.amazon.device.messaging.intent.RECEIVE" />
            <category android:name="de.mypackage"/>
        </intent-filter>
    </receiver>
...
</application>

本地build.gradle看起来像这样:

...

dependencies {
    ...
    provided files('libs/amazon-device-messaging-1.0.1.jar')
    ...
}

愿你有想法吗?

解决方法

您可能在依赖关系部分中有这样的一行:
compile filetree(include: ['*.jar'],dir: 'libs')

这意味着您正在将libs文件夹中的所有jar编译到您的应用程序中.所以可能的说,switch编译提供的答案是有效的,但除了提供你为libs文件夹中的所有jar编译.

您将需要删除filetree行,并手动添加您拥有的任何jar(不包括amazon-device-messaging-1.0.1.jar).

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...