我正在写一个android库来用在我的Unity android项目中,以便使用一个没有好的C#等效库的android库。该库本身已打包,并且工作正常,但当我运行应用程序时,我得到了一个错误:
AndroidJavaException: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/vision/face/FaceDetector$Builder;打开我的AAR,我注意到我正在使用的Google Vision库不在那里,而且由于Unity无法安装android库,它无法解析它。
如何在安装了库的情况下打包应用程序?
下面是我的build.gradle依赖项:
dependencies {
provided fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.10.19'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
provided files('/Applications/Unity/PlaybackEngines/AndroidPlayer/Variations/mono/Release/Classes/classes.jar')
compile 'com.google.android.gms:play-services-vision:8.1.0'
}谢谢!
发布于 2018-01-16 08:18:19
我已经解决了这个问题,尽管是以一种拐弯抹角的间接方式。
我设法在我的m2repository上获得了这个库的AAR,以及它的所有依赖项,然后我还将它们作为Android插件添加到了我的Unity项目中。
这意味着所有类都在作用域中。
https://stackoverflow.com/questions/48272065
复制相似问题