我正在尝试设置一个运行ARCore的非常基本的Sceneform应用程序。我想将此包含在用react-native init PROJECT设置的项目中。根据谷歌提供的这个简单的指南,我将以下内容添加到gradle中:
根build.gradle列出了Sceneform插件依赖项:
buildscript {
…
dependencies {
…
classpath 'com.google.ar.sceneform:plugin:1.3.0'
}
}应用程序build.gradle包含两个Sceneform依赖项,应用插件,并包含将sampledata资产转换为与应用程序一起打包的资源的规则,而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:未能处理/Users/.../.gradle/caches/transforms-1/files-1.1/sceneform-ux-1.3.0.aar/32c1e2ae4c703fa551b4355de5a8e899/jars/classes.jar
我试着清理这个项目,还添加了这些行
defaultConfig {
multiDexEnabled true
}也有同样的结果。
发布于 2018-07-30 13:49:27
好的,显然Java 8语言特性和新/旧Android版本出现了问题。较早的Android版本依赖Java 7,而较新的版本则使用Java 8。
按照这里的步骤正确设置应用程序。
https://stackoverflow.com/questions/51594894
复制相似问题