Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/205.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
将UE4手机游戏与Android Studio捆绑_Android_Android Studio_Apk_Bundle_Unreal Engine4 - Fatal编程技术网

将UE4手机游戏与Android Studio捆绑

将UE4手机游戏与Android Studio捆绑,android,android-studio,apk,bundle,unreal-engine4,Android,Android Studio,Apk,Bundle,Unreal Engine4,我正试图将我的UE4 Android游戏捆绑在Android Studio中,这样谷歌最终会在Play Store上接受它,但我不熟悉Android Studio,有一个代码错误阻止了代码同步 applicationVariants.all { outputs.each { //directly write final APK to Binaries/Android with proper name it.outputFile = file(O

我正试图将我的UE4 Android游戏捆绑在Android Studio中,这样谷歌最终会在Play Store上接受它,但我不熟悉Android Studio,有一个代码错误阻止了代码同步

applicationVariants.all {
      outputs.each {
          //directly write final APK to Binaries/Android with proper name
          it.outputFile = file(OUTPUT_PATH)
      }
}
如图所示的代码生成此错误

错误:无法为ApkVariantOutputImpl\u设置只读属性“outputFile”的值。。。类型为com.android.build.gradle.internal.api.apkvariantoutputinpl

用outputFileName替换outputFile会导致此错误

设置输出文件名时不支持错误绝对路径

对于Gradle 3.0+**

android {
...
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        applicationVariants.all { variant ->
            variant.outputs.all {
                def formattedDate = new Date().format('yyyyMMddHHmmss')
                def flavor = variant.name
                def versionName = variant.versionName
                outputFileName = "AppName_${versionName}_${flavor}_${formattedDate}.apk"
            }
        }
    }
}
...
}
结果:

AppName_发布版_1_20200121175123.apk