简体   繁体   English

无法在Android Stduio中“构建APK”[libGDX]

[英]Can't “Build APK” in Android Stduio [libGDX]

I have some troubles with building a libGDX project on Android. 我在Android上构建libGDX项目时遇到了一些麻烦。 When I choose "Build APK" in Android Studio > Build. 当我在Android Studio> Build中选择“Build APK”时。

A trouble: Error:Execution failed for task ':android:transformClassesWithDexForRelease'. 麻烦:错误:任务执行失败':android:transformClassesWithDexForRelease'。

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\\Program Files\\Android\\Android Studio\\jre\\bin\\java.exe'' finished with non-zero exit value 1 com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:进程'命令'C:\\ Program Files \\ Android \\ Android Studio \\ jre \\ bin \\ java.exe''以非完成零退出值1

What I did: - of course, did a lot of Google; 我做了什么: - 当然,做了很多谷歌; - reinstalled JDK; - 重新安装JDK; - tried to change small settings in gradle config; - 尝试在gradle配置中更改小设置; - tried to change SDK; - 试图改变SDK;

And nothing of above worked... 上面没有任何工作......

So this is my build.gradle: 所以这是我的build.gradle:

android {
buildToolsVersion '24.0.3'
compileSdkVersion 24
sourceSets {
    main {
        manifest.srcFile 'AndroidManifest.xml'
        java.srcDirs = ['src']
        aidl.srcDirs = ['src']
        renderscript.srcDirs = ['src']
        res.srcDirs = ['res']
        assets.srcDirs = ['assets']
        jniLibs.srcDirs = ['libs']
    }

    instrumentTest.setRoot('tests')
}
defaultConfig {
    applicationId "com.wlodek.oneman"
    minSdkVersion 8
    targetSdkVersion 24
}
productFlavors {
}
dexOptions {
    incremental true
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
    buildType {
        debuggable false
        jniDebuggable false
    }
}

I'm not sure, but I had same error when I didn't have enough free ram to compile project. 我不确定,但是当我没有足够的免费ram来编译项目时,我遇到了同样的错误。
I tried close everything like browsers and other unneeded software and after that it worked. 我尝试关闭浏览器和其他不需要的软件之类的所有东西,然后它起作用了。

maybe you can check in the Android Studio's terminal this code to see more information: 也许您可以在Android Studio的终端上查看此代码以查看更多信息:
On Windows: gradlew desktop:run 在Windows上:gradlew桌面:运行
On Mac and Linux: ./gradlew desktop:run 在Mac和Linux上:./ gradlew桌面:运行
In this case i use desktop as launcher, but you can replace it with: android, html, ios, ios-moe 在这种情况下,我使用桌面作为启动器,但你可以用以下内容替换它:android,html,ios,ios-moe

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM