如何避免再次使用依赖项(Android)?
How to avoid use dependencies again (Android)?
我用 Studio 创建了一个 Android 库,这个库需要一些第三库。 build.gradle 如下所示:
dependencies {
compile fileTree(dir: 'libs', include: ['*.*'])
compile 'some library:1.3.2'
compile 'some other library:1.3.4'
}
库可以自由精细地编译,然后我推入本地Maven。一切顺利!
现在我只为我的图书馆样本创建了一个客户端应用程序。我必须遵循的是什么困惑:
dependencies {
compile fileTree(dir: 'libs', include: ['*.*'])
compile 'mylibrary:1.0'
compile 'some library:1.3.2'
compile 'some other library:1.3.4'
}
这意味着包括两个第 3 个库。否则我一定会得到与这两个库相关的错误 "NoClassFound"。
你知道
compile 'mylibrary:1.0'
是包含我的库的意思,但是我为什么要包含另外两个被"mylibrary"使用过的库呢?我可以避免这种情况,只是 -compile 'mylibrary:1.0' ?
好的,我在@CommonsWare 的帮助下解决了项目
查看
http://www.gradle.org/docs/current/userguide/publishing_maven.html
http://maven.apache.org/pom.html
做一个pom.xml自我并完成。
我用 Studio 创建了一个 Android 库,这个库需要一些第三库。 build.gradle 如下所示:
dependencies {
compile fileTree(dir: 'libs', include: ['*.*'])
compile 'some library:1.3.2'
compile 'some other library:1.3.4'
}
库可以自由精细地编译,然后我推入本地Maven。一切顺利!
现在我只为我的图书馆样本创建了一个客户端应用程序。我必须遵循的是什么困惑:
dependencies {
compile fileTree(dir: 'libs', include: ['*.*'])
compile 'mylibrary:1.0'
compile 'some library:1.3.2'
compile 'some other library:1.3.4'
}
这意味着包括两个第 3 个库。否则我一定会得到与这两个库相关的错误 "NoClassFound"。
你知道
compile 'mylibrary:1.0'
是包含我的库的意思,但是我为什么要包含另外两个被"mylibrary"使用过的库呢?我可以避免这种情况,只是 -compile 'mylibrary:1.0' ?
好的,我在@CommonsWare 的帮助下解决了项目 查看
http://www.gradle.org/docs/current/userguide/publishing_maven.html
http://maven.apache.org/pom.html
做一个pom.xml自我并完成。