您当前的位置: 首页 > 

大前端之旅

暂无认证

  • 5浏览

    0关注

    403博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

集成极光推送遇到的问题

大前端之旅 发布时间:2021-01-27 16:50:18 ,浏览量:5

文章目录
      • 解决1:
      • 2.您只需要将minsdkversion更改为21而不是16
      • 这个问题有两种不同的答案,但我认为最合适的是第二种解决方案。
        • 这是Google的官方解释:
        • 原文:
        • 翻译:对Android构建失败进行故障排除:
今天集成极光推送:遇到报错信息:

1.建议minSdkVersion 16改为17 2.

Running Gradle task 'assembleDebug'... Running Gradle task 'assembleDebug'... Done                        11.0s [!] The shrinker may have failed to optimize the Java bytecode.    To disable the shrinker, pass the``flag to this command.    To learn more, see: https://developer.android.com/studio/build/shrink-code Gradle task assembleDebug failed with exit code 1

https://stackoverflow.com/questions/60745249/flutter-the-shrinker-may-have-failed-to-optimize-the-java-bytecode

解决1:

1.我找到了android / app / build.gradle文件

2.然后访问了gradle文件中的以下代码

    buildTypes {
    release {

        // TODO: Add your own signing config for the release build.
        // Signing with the debug keys for now, so `flutter run --release` works.
        signingConfig signingConfigs.debug
    }
}

}

并将其更改为

buildTypes {
    debug {
        minifyEnabled true

        // TODO: Add your own signing config for the release build.
        // Signing with the debug keys for now, so `flutter run --release` works.
        signingConfig signingConfigs.debug
    }
}

}

该应用程序能够在Android模拟器中运行

2.您只需要将minsdkversion更改为21而不是16
 defaultConfig {
        applicationId "com.company.example"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
 }

改为:

 defaultConfig {
        applicationId "com.company.example"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
 }
这个问题有两种不同的答案,但我认为最合适的是第二种解决方案。 这是Google的官方解释: 原文:

If you get an error, make sure that the indentation in your dependencies block is exactly as shown above, using two spaces (not a tab).

(If developing on Android…) Update minSdkVersion

Firebase plugins for Flutter on Android require a slightly higher version of the Android SDK than a default Flutter application.

If you’re developing your application on Android, you’ll need to bump its minSdkVersion to 21 for the app to keep compiling after you add the cloud_firestore dependency:

  1. In your IDE or editor, open the android/app/build.gradle file. Locate the defaultConfig section, which will contain a minSdkVersion entry, and set it to 21:
defaultConfig {
  ...
  minSdkVersion 21     # updated
  minSdkVersion 16
  ...
}
翻译:对Android构建失败进行故障排除:

如果您打算使用Android设备或仿真器进行开发,则需要处理multidex支持-否则,您的构建将因“无法在单个dex文件中容纳请求的类”而失败。

默认情况下,Flutter支持Android SDK v16(Jelly Bean,2012年发布),但multidex并不真正适用于Jelly Bean(尽管有可能)。配置Jelly Bean正常工作超出了此代码实验室的范围,因此我们将最低目标SDK版本从v16更改为v21(Lollipop,2014年发布)。

要更改最低目标SDK版本:

  1. 打开android / app / build.gradle,然后找到显示minSdkVersion 16的行。
  2. 将该行更改为minSdkVersion 21。
  3. 保存文件。 链接
关注
打赏
1660524863
查看更多评论
立即登录/注册

微信扫码登录

0.1955s