Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何构建符合Google Play 64位要求的应用程序?_Android_Dart_Flutter - Fatal编程技术网

Android 如何构建符合Google Play 64位要求的应用程序?

Android 如何构建符合Google Play 64位要求的应用程序?,android,dart,flutter,Android,Dart,Flutter,在我上传APK到play store后,我收到了以下警告。为了满足64位的要求,我应该做哪些更改来发布带有flutter SDK的APK构建 警告信息: 伙计们,他们为64位体系结构更改了新策略。所以请把这个代码放在你的渐变里 ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64' 例如 android { compileSdkVersion 28 defaultConfig { applicationId

在我上传APK到play store后,我收到了以下警告。为了满足64位的要求,我应该做哪些更改来发布带有flutter SDK的APK构建

警告信息:
伙计们,他们为
64位
体系结构更改了新策略。所以请把这个代码放在你的渐变里

ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
例如

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.test.test"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
}

Edit/Update:
Google在稳定频道中发布了flatter 1.7.8+修补程序.3,这使得构建发布应用程序变得容易。

现在您有两个要构建的选项:

  • 应用程序包(首选)
  • APK
  • 生成应用程序包

    运行
    flatterbuildappbundle

    这将创建
    /build/app/outputs/bundle/release/app.aab


    T应用程序包包含您的Dart代码和为
    armeabi-v7a(32位)
    arm64-v8a(64位)
    编译的颤振运行时

    现在您可以将此应用程序包上载到google play

    建立一个APK

    此命令生成两个APK文件:

    <app dir>/build/app/outputs/apk/release/app-armeabi-v7a-release.apk
    <app dir>/build/app/outputs/apk/release/app-arm64-v8a-release.apk
    
    上载此新apk并开始卷展栏


    祝你好运

    使用最新的颤振主通道。
    flatterbuildapk
    将生成一个包含32位和64位支持的胖apk


    要分别创建32位和64位APK,请使用
    flatter build APK--split per abi
    命令

    flutter build appbundle --release 
    
    上载appbundle文件

    然后增加pubspec.yml文件中的版本和内部版本号并运行

    flutter build apk --release --target-platform=android-arm64
    
    flutter build appbundle --release --target-platform=android-arm64
    
    还可以上载此新appbundle


    然后游戏商店接受了我的版本

    现在futter团队提供了一个新的更好的解决方案。
    您需要使用新的颤振版本1.7.12。(我的设置)

    然后,您可以使用此命令为x86和x64构建(单个)应用程序包。
    flatterbuildappbundle


    另外,您可以添加
    --发布--目标平台android arm,android-arm64
    。但这可能会导致应用程序损坏…

    flatter 1.5.4-hotfix.2 appbundle目前的目标是只构建32位本机代码的android arm(
    flatter build appbundle-h
    )。要更改此运行
    flatter build appbundle--target platform=android-arm64
    ,请更改默认目标。

    我使用此代码构建了我的应用程序,但仍然会收到错误


    flatter build appbundle--target platform=android-arm64

    我终于能够通过将它添加到build.gradle中来解决这个问题

     ndk {
            abiFilters  "armeabi-v7a", "arm64-v8a"
        }
    }
    
    splits {
        abi {
            include  "armeabi-v7a", "arm64-v8a"
        }
     }
     applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            def versionCodes = ["armeabi-v7a":1, "arm64-v8a":2]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
     }
    

    关于这一点,没有太多明确的文档,我在浏览互联网时碰巧遇到了这一点。

    如果您使用的是Android Studio


    只需转到构建->颤振->构建应用程序包即可在上传到google play时将其替换为apk

    将此行添加到您的android/App/Build.gradle文件中

    ndk{
    ABI过滤器“armeabi-v7a”、“arm64-v8a”、“x86”、“x86_64”
    
    }

    @Stefan您面临什么问题?我将该行添加到配置中,然后运行
    flatter build apk
    ,并将apk上传到google play。google play控制台出现了相同的错误…仅在切换到颤振主频道后对我有效。您有没有不使用颤振的解决方案?仅在切换到颤振主频道后对我有效。颤振团队现在提供了一个解决方案(版本>1.7.12)。见下面我的答案。对于稳定通道上的Flatter 1.7.8+修补程序.3,如果我现在构建应用程序包,它将同时具有32位和64位,还是我只需要使用主通道构建它?为什么不只使用Flatter构建应用程序包?我已经尝试了所有可能的命令,包括那个命令,同样的错误
    Flutter 1.7.12-pre.40 • channel master • https://github.com/flutter/flutter.git
    Framework • revision 3badcf51a4 (13 hours ago) • 2019-06-28 15:14:03 -0700
    Engine • revision e96900df2f
    Tools • Dart 2.4.0
    
     ndk {
            abiFilters  "armeabi-v7a", "arm64-v8a"
        }
    }
    
    splits {
        abi {
            include  "armeabi-v7a", "arm64-v8a"
        }
     }
     applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            def versionCodes = ["armeabi-v7a":1, "arm64-v8a":2]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
     }