[英]Library for android, using android jar
我想制作一個使用SharedPreferences的庫。 現在要做的是,我需要有android.jar可用。 但是,由於我的項目永遠不會獨立運行,因此我高度懷疑使其成為功能完善的android應用程序是正確的方法。
現在,我有以下build.gradle:
apply plugin: 'eclipse'
apply plugin: 'maven'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
}
}
apply plugin: 'android-library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
testCompile 'junit:junit:4.12'
testCompile 'org.slf4j:slf4j-simple:1.6.1'
}
}
而且還會出現以下錯誤:
失敗:構建失敗,發生異常。
出了什么問題:配置根項目'NetworkSynchronizer'時出現問題。
java.io.FileNotFoundException:D:\\ Users \\ Beheerder \\ git \\ NetworkSynchronizer \\ src \\ main \\ AndroidManifest.xml(系統找不到指定的文件)
嘗試:使用--stacktrace選項運行以獲取堆棧跟蹤。 使用--info或--debug選項運行以獲取更多日志輸出。
這是正確的方法嗎?我應該只是添加一個AndroidManifest.xml,還是應該如何處理?
將AndroidManifest添加到您的庫中:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="<YOUR_PACKAGE_HERE>">
<application android:allowBackup="true"
android:label="@string/app_name">
</application>
</manifest>
因為您使用的是android-library插件,所以那絕對是正常的。 最后,您將獲得@aar文件,而不是jar。 祝好運!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.