【问题标题】:Bundle UE4 Mobile game with Android Studio将 UE4 手机游戏与 Android Studio 捆绑
【发布时间】:2019-10-12 09:59:09
【问题描述】:

我正在尝试在 Android Studio 中捆绑我的 UE4 Android 游戏,因此 Google 最终会在 Play 商店中接受它,但我不熟悉 Android Studio,并且有 1 个代码错误阻止代码同步。

applicationVariants.all {
      outputs.each {
          //directly write final APK to Binaries/Android with proper name
          it.outputFile = file(OUTPUT_PATH)
      }
}

如图所示的代码会产生此错误

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

将 outputFile 替换为 outputFileName 会导致此错误

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

【问题讨论】:

    标签: android android-studio apk bundle unreal-engine4


    【解决方案1】:

    来自this

    对于 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_release_1_20200121175123.apk

    【讨论】:

      猜你喜欢
      • 2020-09-02
      • 2017-01-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多