当我尝试构建microG时,我总是遇到此错误:
$ ./gradlew build
Skipping debug jar:microg-ui-tools:preBuild UP-TO-DATE
:microg-ui-tools:preDebugBuild UP-TO-DATE
:microg-ui-tools:checkDebugManifest
:microg-ui-tools:preDebugAndroidTestBuild UP-TO-DATE
:microg-ui-tools:preDebugUnitTestBuild UP-TO-DATE
:microg-ui-tools:preReleaseBuild UP-TO-DATE
:microg-ui-tools:preReleaseUnitTestBuild UP-TO-DATE
:microg-ui-tools:prepareComAndroidSupportAnimatedVectorDrawable2531Library
:microg-ui-tools:prepareComAndroidSupportAppcompatV72531Library
:microg-ui-tools:prepareComAndroidSupportPreferenceV142531Library
:microg-ui-tools:prepareComAndroidSupportPreferenceV72531Library
:microg-ui-tools:prepareComAndroidSupportRecyclerviewV72531Library
:microg-ui-tools:prepareComAndroidSupportSupportCompat2531Library
:microg-ui-tools:prepareComAndroidSupportSupportCoreUi2531Library
:microg-ui-tools:prepareComAndroidSupportSupportCoreUtils2531Library
:microg-ui-tools:prepareComAndroidSupportSupportFragment2531Library
:microg-ui-tools:prepareComAndroidSupportSupportMediaCompat2531Library
:microg-ui-tools:prepareComAndroidSupportSupportV42531Library
:microg-ui-tools:prepareComAndroidSupportSupportVectorDrawable2531Library
:microg-ui-tools:prepareComTakisoftFixPreferenceV725310Library
:microg-ui-tools:prepareDebugDependencies
:microg-ui-tools:compileDebugAidl UP-TO-DATE
:microg-ui-tools:compileDebugNdk UP-TO-DATE
:microg-ui-tools:compileLint UP-TO-DATE
:microg-ui-tools:copyDebugLint UP-TO-DATE
:microg-ui-tools:compileDebugRenderscript UP-TO-DATE
:microg-ui-tools:generateDebugBuildConfig UP-TO-DATE
:microg-ui-tools:generateDebugResValues UP-TO-DATE
:microg-ui-tools:generateDebugResources UP-TO-DATE
:microg-ui-tools:mergeDebugResources
java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment
:microg-ui-tools:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':microg-ui-tools:mergeDebugResources'.
> java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment
* 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: 2.932 secs
这是在无头服务器上,甚至没有安装X服务器!发生这种情况也是为了发布(mergeReleaseResources
除外)。我尝试使用--info
和--debug
投放,但它并没有给我任何有用的信息。我也试过切换到使用Oracle的JDK而不是OpenJDK并在机器制造商上安装本地X服务器,但这也没有改变任何东西。这是一个刚刚克隆的回购副本,虽然我不认为这个错误是针对microG的。
以下是我的结果./gradlew build --stacktrace
:https://gist.github.com/milkey-mouse/cb6b75b5116cf369603dec46e214e914
答案 0 :(得分:6)
您可以尝试将-Djava.awt.headless=true
添加到jvmargs
文件中的gradle.properties
:
org.gradle.jvmargs=-Djava.awt.headless=true
另请参阅示例here。
以下是similar question,但与Gradle无关。