Android 支持库don';我不能和aar一起工作
我的图书馆项目面临一个问题。我在lib的Android 支持库don';我不能和aar一起工作,android,maven,android-support-library,Android,Maven,Android Support Library,我的图书馆项目面临一个问题。我在lib的build.gradle中添加了支持依赖项,并在代码中使用了它们。当我构建要在Maven上使用的.aar文件时,支持依赖项被“忽略”,我使用lib的项目看不到它们 以下是我在lib的gradle中收到的警告: 依赖于支持库,但SDK安装没有安装“Extras>Android支持库”。打开SDK管理器并安装它。 显然,我已经安装了最新版本的支持存储库 以下是lib的梯度: apply plugin: 'com.android.library' andro
build.gradle
中添加了支持依赖项,并在代码中使用了它们。当我构建要在Maven
上使用的.aar
文件时,支持依赖项被“忽略”,我使用lib的项目看不到它们
以下是我在lib的gradle
中收到的警告:
依赖于支持库,但SDK安装没有安装“Extras>Android支持库”。打开SDK管理器并安装它。
显然,我已经安装了最新版本的支持存储库
以下是lib的梯度:
apply plugin: 'com.android.library'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:recyclerview-v7:22.2.0'
compile 'com.android.support:support-v4:22.2.0'
compile 'com.android.support:design:22.2.0'
}
}
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.fondesa</groupId>
<artifactId>antoniolimaterial</artifactId>
<version>1.0.0</version>
<packaging>aar</packaging>
<name>Antonioli Material</name>
<description>Antonioli material library</description>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<id>giorgio.antonioli</id>
<name>Giorgio Antonioli</name>
</developer>
</developers>
<dependencies>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>appcompat-v7</artifactId>
<version>22.2.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>support-v4</artifactId>
<version>22.2.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>recyclerview-v7</artifactId>
<version>22.2.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>design</artifactId>
<version>22.2.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
在我添加库作为依赖项的项目中,例如在styles.xml中,我看不到AppCompat主题
下面是应用程序的渐变:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "giorgioantonioli.fondesa.spesapp"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile ('com.fondesa:antoniolimaterial:1.0.0@aar'){ //lib
transitive = true;
}
}
已解决 我没有将依赖项添加到库的.pom文件:
apply plugin: 'com.android.library'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:recyclerview-v7:22.2.0'
compile 'com.android.support:support-v4:22.2.0'
compile 'com.android.support:design:22.2.0'
}
}
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.fondesa</groupId>
<artifactId>antoniolimaterial</artifactId>
<version>1.0.0</version>
<packaging>aar</packaging>
<name>Antonioli Material</name>
<description>Antonioli material library</description>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<id>giorgio.antonioli</id>
<name>Giorgio Antonioli</name>
</developer>
</developers>
<dependencies>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>appcompat-v7</artifactId>
<version>22.2.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>support-v4</artifactId>
<version>22.2.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>recyclerview-v7</artifactId>
<version>22.2.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>design</artifactId>
<version>22.2.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
@Hugogress现在我不能尝试,但当我尝试的时候,我会写下response@HugoGresse这并没有解决问题。我已经试过你的代码,它正在正常工作。一定要更新SDK(我知道你说你有,但…),我也在一个库中测试过,它是working@GabrieleMariotti谢谢!