首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在android库包中包含一个外部库

在android库包中包含一个外部库
EN

Stack Overflow用户
提问于 2018-01-16 07:22:07
回答 1查看 59关注 0票数 0

我正在写一个android库来用在我的Unity android项目中,以便使用一个没有好的C#等效库的android库。该库本身已打包,并且工作正常,但当我运行应用程序时,我得到了一个错误:

代码语言:javascript
复制
AndroidJavaException: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/vision/face/FaceDetector$Builder;

打开我的AAR,我注意到我正在使用的Google Vision库不在那里,而且由于Unity无法安装android库,它无法解析它。

如何在安装了库的情况下打包应用程序?

下面是我的build.gradle依赖项:

代码语言:javascript
复制
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'
    }

谢谢!

EN

回答 1

Stack Overflow用户

发布于 2018-01-16 08:18:19

我已经解决了这个问题,尽管是以一种拐弯抹角的间接方式。

我设法在我的m2repository上获得了这个库的AAR,以及它的所有依赖项,然后我还将它们作为Android插件添加到了我的Unity项目中。

这意味着所有类都在作用域中。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48272065

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档