Android Studio:如何在XML中使用派生库?

时间:2018-12-08 12:08:37

标签: android xml android-studio github

我正在尝试使用PhotoView库的分叉版本,似乎无法找到在XML中使用其标记的方法,有什么主意吗?

(我是android studio的新手)

原始标签:

<com.github.chrisbanes.photoview.PhotoView/>

我的叉子:https://github.com/regiregi2/PhotoView

依赖性:implementation 'com.github.regiregi2:PhotoView:master-SNAPSHOT'

2 个答案:

答案 0 :(得分:0)

您只需将软件包名称com.github.chrisbanes.photoview重构为com.github.regiregi2.photoview,然后使用它的绝对类名即可:

<com.github.regiregi2.photoview.PhotoView />

除非进行重构,否则绝对类名仍为:

<com.github.chrisbanes.photoview.PhotoView/>

答案 1 :(得分:0)

将此添加到您的root build.gradle根文件中(而不是您的模块build.gradle文件中):

allprojects {
repositories {
    maven { url "https://jitpack.io" }
}

}

然后,将库添加到模块build.gradle

dependencies {
implementation 'com.github.chrisbanes:PhotoView:latest.release.here'

}