极光:Unable to get provider cn.jpush.android.service.DownloadProvider

最近需要将公司以前的项目,安装在一个版本为4.4.2的安卓板子上,准备降级操作。

报错:java.lang.RuntimeException: Unable to get provider com.amitshekhar.DebugDBInitProvider: java.lang.ClassNotFoundException: Didn't find class

项目中是由于multiDex配置原因。

因为以前支持版本号为21,现在使用 multidex 需要引入谷歌提供的 android-support-multidex.jar 包。

解决方法:

1.defaultConfig 中添加 

defaultConfig {
        ······
 
        multiDexEnabled true
 
        ······
}
2.dependencies 中添加

implementation 'com.android.support:multidex:1.0.3'
3.代码中加入支持 multidex 的功能:

重写 Application 的 attachBaseContext 方法。

在该方法里面加入MultiDex.install(this),这个方法比 Application 的 onCreate 要先执行。 

    @Override
    protected void attachBaseContext(Context base){
        super.attachBaseContext(base);
        MultiDex.install(this);
    }
4.重新运行
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
极光提供了 Flutter 插件,方便开发者在 Flutter 应用中使用推送、IM、统计等功能。以下是在 Flutter 中集成极光推送的基本步骤: 1. 在极光官网注册账号,并创建应用,获取 AppKey 和 Master Secret。 2. 在 Flutter 项目中添加极光推送插件,可以通过在 `pubspec.yaml` 文件中添加以下代码来引入插件: ```yaml dependencies: jpush_flutter: ^2.8.2 ``` 3. 在应用的入口处调用 `JPush.init()` 方法初始化 JPush SDK。 4. 在 Android 平台上,需要在 `AndroidManifest.xml` 文件中添加以下代码注册 JPush SDK: ```xml <receiver android:name="cn.jpush.android.service.PushReceiver" android:exported="false"> <intent-filter> <action android:name="cn.jpush.android.intent.RECEIVE_MESSAGE" /> <action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED" /> <action android:name="cn.jpush.android.intent.NOTIFICATION_OPENED" /> <action android:name="cn.jpush.android.intent.REGISTRATION" /> <action android:name="cn.jpush.android.intent.UNREGISTRATION" /> <category android:name="${applicationId}" /> </intent-filter> </receiver> <receiver android:name="cn.jpush.android.service.AlarmReceiver" android:exported="false" /> <service android:name="cn.jpush.android.service.PushService" android:enabled="true" android:exported="false"> <intent-filter> <action android:name="cn.jpush.android.intent.REGISTER" /> <action android:name="cn.jpush.android.intent.REPORT" /> <action android:name="cn.jpush.android.intent.PushService" /> <action android:name="cn.jpush.android.intent.PUSH_TIME" /> </intent-filter> </service> <provider android:name="cn.jpush.android.service.DownloadProvider" android:authorities="${applicationId}.DownloadProvider" android:exported="false" /> <meta-data android:name="JPUSH_CHANNEL" android:value="${JPUSH_CHANNEL}" /> <meta-data android:name="JPUSH_APPKEY" android:value="${JPUSH_APPKEY}" /> ``` 5. 在 iOS 平台上,需要在 `Info.plist` 文件中添加以下代码: ```xml <!-- Required --> <key>CFBundleDisplayName</key> <string>$(PRODUCT_NAME)</string> <key>CFBundleIdentifier</key> <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <key>CFBundleVersion</key> <string>$(CURRENT_PROJECT_VERSION)</string> <!-- Required for iOS 10--> <key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> </dict> <!-- Required for iOS 8.0+ --> <key>UIBackgroundModes</key> <array> <string>remote-notification</string> </array> <!-- Required --> <key>JPushAppkey</key> <string>YOUR_APP_KEY</string> <key>JPushChannel</key> <string>YOUR_CHANNEL</string> <key>JPushIsProduction</key> <false/> ``` 6. 调用 `JPush.setAlias(alias)` 方法设置别名,用于标识用户。 7. 在极光官网的控制台中进行推送消息的配置和发送。 以上是基本的步骤,具体可以参考极光官网提供的文档。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值