React Native Android - gradlew assembleRelease命令无法生成apk输出

时间:2017-07-11 11:24:45

标签: android windows android-studio react-native apk

我目前正在为我的Android应用程序使用React Native。 RN的版本为0.46.1,CLI为2.0.1。根据我的Android Studio,Gradle是版本3.3。

我设法使用" react-native run-android"将我的应用安装到Android模拟器中没有太多问题。它工作正常,但当我尝试生成apk时,我遇到了一些错误。我在Windows 10上运行。

执行的命令:

react-native bundle --platform android --dev false --entry-file index.android.js \ --bundle-output android/app/src/main/assets/index.android.bundle \ --assets-dest android/app/src/main/res/

cd android && gradlew assembleRelease

在上面第二个命令之后,我遇到了一些错误:

:app:mergeReleaseResources
[drawable-mdpi-v4/node_modules_reactnativecheckbox_cb_disabled] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\node_modules_reactnativecheckbox_cb_disabled.png      [drawable-mdpi-v4/node_modules_reactnativecheckbox_cb_disabled] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\node_modules_reactnativecheckbox_cb_disabled.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_travel022] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_travel022.jpg    [drawable-mdpi-v4/assets_travel022] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_travel022.jpg: Error: Duplicate resources
[drawable-mdpi-v4/node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white.png        [drawable-mdpi-v4/node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_up128] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_up128.png        [drawable-mdpi-v4/assets_up128] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_up128.png: Error: Duplicate resources
[drawable-xxxhdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-xxxhdpi\node_modules_reactnativeexperimentalnavigation_assets_back.png  [drawable-xxxhdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-xxxhdpi-v4\node_modules_reactnativeexperimentalnavigation_assets_back.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_openenvelopewithletter_31832670] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_openenvelopewithletter_31832670.jpg      [drawable-mdpi-v4/assets_openenvelopewithletter_31832670] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_openenvelopewithletter_31832670.jpg: Error: Duplicate resources
[drawable-xhdpi-v4/node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white] D:\travelogue\FE27\android\app\src\main\res\drawable-xhdpi\node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white.png  [drawable-xhdpi-v4/node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white] D:\travelogue\FE27\android\app\src\main\res\drawable-xhdpi-v4\node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_down128] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_down128.png  [drawable-mdpi-v4/assets_down128] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_down128.png: Error: Duplicate resources
[drawable-mdpi-v4/node_modules_reactnativecheckbox_cb_enabled] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\node_modules_reactnativecheckbox_cb_enabled.png  [drawable-mdpi-v4/node_modules_reactnativecheckbox_cb_enabled] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\node_modules_reactnativecheckbox_cb_enabled.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_weather1gif] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_weather1gif.png  [drawable-mdpi-v4/assets_weather1gif] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_weather1gif.png: Error: Duplicate resources
[drawable-mdpi-v4/node_modules_reactnativerouterflux_src_back_chevron] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\node_modules_reactnativerouterflux_src_back_chevron.png  [drawable-mdpi-v4/node_modules_reactnativerouterflux_src_back_chevron] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\node_modules_reactnativerouterflux_src_back_chevron.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_accommodation_icon1] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_accommodation_icon1.png  [drawable-mdpi-v4/assets_accommodation_icon1] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_accommodation_icon1.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_noimage] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_noimage.gif    [drawable-mdpi-v4/assets_noimage] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_noimage.gif: Error: Duplicate resources
[drawable-xhdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-xhdpi\node_modules_reactnativeexperimentalnavigation_assets_back.png  [drawable-xhdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-xhdpi-v4\node_modules_reactnativeexperimentalnavigation_assets_back.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_itineraryicon] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_itineraryicon.png      [drawable-mdpi-v4/assets_itineraryicon] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_itineraryicon.png: Error: Duplicate resources
[drawable-mdpi-v4/node_modules_reactnativedatepicker_date_icon] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\node_modules_reactnativedatepicker_date_icon.png    [drawable-mdpi-v4/node_modules_reactnativedatepicker_date_icon] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\node_modules_reactnativedatepicker_date_icon.png: Error: Duplicate resources
[drawable-xxhdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-xxhdpi\node_modules_reactnativeexperimentalnavigation_assets_back.png    [drawable-xxhdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-xxhdpi-v4\node_modules_reactnativeexperimentalnavigation_assets_back.png: Error: Duplicate resources
[drawable-xxhdpi-v4/node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white] D:\travelogue\FE27\android\app\src\main\res\drawable-xxhdpi\node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white.png    [drawable-xxhdpi-v4/node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white] D:\travelogue\FE27\android\app\src\main\res\drawable-xxhdpi-v4\node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white.png: Error: Duplicate resources
[drawable-hdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-hdpi\node_modules_reactnativeexperimentalnavigation_assets_back.png        [drawable-hdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-hdpi-v4\node_modules_reactnativeexperimentalnavigation_assets_back.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_travelguide] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_travelguide.jpg    [drawable-mdpi-v4/assets_travelguide] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_travelguide.jpg: Error: Duplicate resources
[drawable-mdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\node_modules_reactnativeexperimentalnavigation_assets_back.png    [drawable-mdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\node_modules_reactnativeexperimentalnavigation_assets_back.png: Error: Duplicate resources
[drawable-mdpi-v4/node_modules_reactnativerouterflux_src_menu_burger] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\node_modules_reactnativerouterflux_src_menu_burger.png    [drawable-mdpi-v4/node_modules_reactnativerouterflux_src_menu_burger] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\node_modules_reactnativerouterflux_src_menu_burger.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_embedplacesicon] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_embedplacesicon.png    [drawable-mdpi-v4/assets_embedplacesicon] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_embedplacesicon.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_diningicon] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_diningicon.png      [drawable-mdpi-v4/assets_diningicon] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_diningicon.png: Error: Duplicate resources
:app:mergeReleaseResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeReleaseResources'.
> [drawable-mdpi-v4/node_modules_reactnativecheckbox_cb_disabled] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\node_modules_reactnativecheckbox_cb_disabled.png    [drawable-mdpi-v4/node_modules_reactnativecheckbox_cb_disabled] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\node_modules_reactnativecheckbox_cb_disabled.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_travel022] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_travel022.jpg    [drawable-mdpi-v4/assets_travel022] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_travel022.jpg: Error: Duplicate resources
[drawable-mdpi-v4/node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white.png        [drawable-mdpi-v4/node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_up128] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_up128.png        [drawable-mdpi-v4/assets_up128] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_up128.png: Error: Duplicate resources
[drawable-xxxhdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-xxxhdpi\node_modules_reactnativeexperimentalnavigation_assets_back.png  [drawable-xxxhdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-xxxhdpi-v4\node_modules_reactnativeexperimentalnavigation_assets_back.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_openenvelopewithletter_31832670] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_openenvelopewithletter_31832670.jpg      [drawable-mdpi-v4/assets_openenvelopewithletter_31832670] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_openenvelopewithletter_31832670.jpg: Error: Duplicate resources
[drawable-xhdpi-v4/node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white] D:\travelogue\FE27\android\app\src\main\res\drawable-xhdpi\node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white.png  [drawable-xhdpi-v4/node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white] D:\travelogue\FE27\android\app\src\main\res\drawable-xhdpi-v4\node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_down128] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_down128.png  [drawable-mdpi-v4/assets_down128] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_down128.png: Error: Duplicate resources
[drawable-mdpi-v4/node_modules_reactnativecheckbox_cb_enabled] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\node_modules_reactnativecheckbox_cb_enabled.png  [drawable-mdpi-v4/node_modules_reactnativecheckbox_cb_enabled] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\node_modules_reactnativecheckbox_cb_enabled.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_weather1gif] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_weather1gif.png  [drawable-mdpi-v4/assets_weather1gif] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_weather1gif.png: Error: Duplicate resources
[drawable-mdpi-v4/node_modules_reactnativerouterflux_src_back_chevron] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\node_modules_reactnativerouterflux_src_back_chevron.png  [drawable-mdpi-v4/node_modules_reactnativerouterflux_src_back_chevron] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\node_modules_reactnativerouterflux_src_back_chevron.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_accommodation_icon1] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_accommodation_icon1.png  [drawable-mdpi-v4/assets_accommodation_icon1] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_accommodation_icon1.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_noimage] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_noimage.gif    [drawable-mdpi-v4/assets_noimage] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_noimage.gif: Error: Duplicate resources
[drawable-xhdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-xhdpi\node_modules_reactnativeexperimentalnavigation_assets_back.png  [drawable-xhdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-xhdpi-v4\node_modules_reactnativeexperimentalnavigation_assets_back.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_itineraryicon] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_itineraryicon.png      [drawable-mdpi-v4/assets_itineraryicon] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_itineraryicon.png: Error: Duplicate resources
[drawable-mdpi-v4/node_modules_reactnativedatepicker_date_icon] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\node_modules_reactnativedatepicker_date_icon.png    [drawable-mdpi-v4/node_modules_reactnativedatepicker_date_icon] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\node_modules_reactnativedatepicker_date_icon.png: Error: Duplicate resources
[drawable-xxhdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-xxhdpi\node_modules_reactnativeexperimentalnavigation_assets_back.png    [drawable-xxhdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-xxhdpi-v4\node_modules_reactnativeexperimentalnavigation_assets_back.png: Error: Duplicate resources
[drawable-xxhdpi-v4/node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white] D:\travelogue\FE27\android\app\src\main\res\drawable-xxhdpi\node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white.png    [drawable-xxhdpi-v4/node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white] D:\travelogue\FE27\android\app\src\main\res\drawable-xxhdpi-v4\node_modules_reactnativegoogleplacesautocomplete_images_powered_by_google_on_white.png: Error: Duplicate resources
[drawable-hdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-hdpi\node_modules_reactnativeexperimentalnavigation_assets_back.png        [drawable-hdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-hdpi-v4\node_modules_reactnativeexperimentalnavigation_assets_back.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_travelguide] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_travelguide.jpg    [drawable-mdpi-v4/assets_travelguide] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_travelguide.jpg: Error: Duplicate resources
[drawable-mdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\node_modules_reactnativeexperimentalnavigation_assets_back.png    [drawable-mdpi-v4/node_modules_reactnativeexperimentalnavigation_assets_back] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\node_modules_reactnativeexperimentalnavigation_assets_back.png: Error: Duplicate resources
[drawable-mdpi-v4/node_modules_reactnativerouterflux_src_menu_burger] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\node_modules_reactnativerouterflux_src_menu_burger.png    [drawable-mdpi-v4/node_modules_reactnativerouterflux_src_menu_burger] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\node_modules_reactnativerouterflux_src_menu_burger.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_embedplacesicon] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_embedplacesicon.png    [drawable-mdpi-v4/assets_embedplacesicon] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_embedplacesicon.png: Error: Duplicate resources
[drawable-mdpi-v4/assets_diningicon] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi\assets_diningicon.png      [drawable-mdpi-v4/assets_diningicon] D:\travelogue\FE27\android\app\src\main\res\drawable-mdpi-v4\assets_diningicon.png: Error: Duplicate resources

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 1 mins 20.5 secs

我发现一些论坛讨论类似的问题https://github.com/facebook/react-native/issues/5787但它并没有真正解决问题(尝试删除生成的输出文件,甚至是论坛中建议的代码片段代码)。

1 个答案:

答案 0 :(得分:0)

我也遇到了这个问题。这是我修复它的方法。这是最复杂和最健壮的方式 - 最后可以看到更简单的选项。

  1. 重命名了我的所有android/app/src/main/res/drawable-*个文件夹,向所有文件夹添加了-v4。 (在此之后,它们看起来像:drawable-xhdpi-v4drawable-ldpi-v4等。)注意:不要更改drawable文件夹本身。
  2. 向package.json添加安装后挂钩,通过将node_modules/react-native/local-cli/bundle/assetPathUtils.js添加到所有switch语句的返回值来修复-v4文件。 assetPathUtils.js文件中生成的switch语句应如下所示:

    switch (scale) {
        case 0.75: return 'ldpi-v4';
        case 1: return 'mdpi-v4';
        case 1.5: return 'hdpi-v4';
        case 2: return 'xhdpi-v4';
        case 3: return 'xxhdpi-v4';
        case 4: return 'xxxhdpi-v4';
    }
    
  3. 这是编写安装后挂钩的一种方法:

    const sh = require('shelljs');
    const fileToFix =
        'node_modules/react-native/local-cli/bundle/assetPathUtils.js';
    const replacements = [
        ["case 0.75: return 'ldpi';", "case 0.75: return 'ldpi-v4';"],
        ["case 1: return 'mdpi';", "case 1: return 'mdpi-v4';"],
        ["case 1.5: return 'hdpi';", "case 1.5: return 'hdpi-v4';"],
        ["case 2: return 'xhdpi';", "case 2: return 'xhdpi-v4';"],
        ["case 3: return 'xxhdpi';", "case 3: return 'xxhdpi-v4';"],
        ["case 4: return 'xxxhdpi';", "case 4: return 'xxxhdpi-v4';"],
    ];
    const content = sh.cat(fileToFix).stdout;
    const fixedContent = replacements.reduce(
        (accumulator, [oldStr, newStr]) => accumulator.replace(oldStr, newStr),
        content
    );
    sh.ShellString(fixedContent).to(fileToFix);
    

    并在package.json

    中注册
    ...
    "scripts": {
        "postinstall": "node ./postinstall.js",
    ...
    

    来自5787 issue的其他修正:

    • 如果您的drawable-*文件夹中没有任何自定义图标,那么您应该能够将它们全部删除并让事情以这种方式运行。 (这是我个人未确认过的)
    • 如果您不需要使用gradle v3 +,那么降级回Gradle v2。*将解决问题 - 尽管Android工作室会不断提示您升级gradle。