[英]How to handle model scaling in Sceneform/ARCore on Android?
[英]Android App does not compile when SceneForm/ARCore added to Gradle
我正在嘗試使用Sceneform
運行一個非常基本的ARCore
應用程序。 我想將此包含在使用react-native init PROJECT
設置的react-native init PROJECT
。 遵循Google這份簡單明了的指南 ,我將其添加到了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'
我的root 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
}
並具有相同的結果。
好吧,顯然問題出在Java 8語言功能和新舊Android SDK版本上。 較舊的Android SDK版本依賴Java 7,而較新的版本則使用Java 8。
請按照此處的步驟正確設置您的應用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.