gpt4 book ai didi

java - 将SceneForm/ARCore添加到Gradle时,Android App无法编译

转载 作者:行者123 更新时间:2023-12-03 05:43:00 28 4
gpt4 key购买 nike

我正在尝试使用ARCore运行一个非常基本的Sceneform应用程序。我想将此包含在使用react-native init PROJECT设置的项目中。
遵循来自Google的简单guide之后,我将其添加到gradle中:

build.gradle列出了Sceneform插件依赖项:

buildscript {

dependencies {

classpath 'com.google.ar.sceneform:plugin:1.3.0'
}
}

应用程序 build.gradle包含两个Sceneform依赖项,应用了插件,并包含了一个规则,用于将sampledata Assets 转换为与应用程序打包在一起的资源,并且Sceneform可以在运行时加载:

dependencies {

implementation 'com.google.ar.sceneform:core:1.3.0'
implementation 'com.google.ar.sceneform.ux:sceneform-ux:1.3.0'
}

apply plugin: 'com.google.ar.sceneform.plugin'

我的根 build.gradle现在看起来如下
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.ar.sceneform:plugin:1.3.0'

而我的应用程序 build.gradle看起来像这样。
dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
compile "com.facebook.react:react-native:+" // From node_modules
implementation 'com.google.ar.sceneform:core:1.3.0'
implementation 'com.google.ar.sceneform.ux:sceneform-ux:1.3.0'

}

当我尝试编译时,我得到:

com.android.build.api.transform.TransformException: com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process /Users/.../.gradle/caches/transforms-1/files-1.1/sceneform-ux-1.3.0.aar/32c1e2ae4c703fa551b4355de5a8e899/jars/classes.jar



我试图清理项目以及添加这些行
defaultConfig {
multiDexEnabled true
}

并具有相同的结果。

最佳答案

好吧,显然问题出在Java 8语言功能和新旧Android SDK版本上。较旧的Android SDK版本依赖Java 7,而较新的版本则使用Java 8。

请按照here步骤正确设置您的应用。

关于java - 将SceneForm/ARCore添加到Gradle时,Android App无法编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51594894/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com