我正在開發一個應用程序,並試圖使用新的材料設計,又名sdk版本21. 我有一切工作正常,然後想在晶圓廠(浮動行動按鈕)使用this library。Git子模塊導致失敗[INSTALL_FAILED_OLDER_SDK] Android sdk 21
我添加了這個庫作爲一個子模塊,使用
git submodule add https://github.com/shamanland/floating-action-button
,同時在C:\用戶\ USER \ AndroidStudioProjects \項目名
我的文件結構看起來像這樣
ProjectName
app
floating-action-button
問題 在一切都很好之前,我能夠構建並運行項目。 但是,自從加入這個子模塊,試圖運行它的時候,我得到的錯誤
Failure [INSTALL_FAILED_OLDER_SDK]
所以我想它與子模塊做的,但我不知道怎麼樣。
應用程序/的build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion '21.0.2'
defaultConfig {
applicationId "com.mayuonline.ribbit"
minSdkVersion 21
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:21.+'
compile 'com.android.support:cardview-v7:+'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.android.support:palette-v7:+'
}
應用程序/ AndroidManifest.xml中
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="resume.kelseyhrubes">
<uses-sdk tools:node="replace" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
F-A-B /的build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.2'
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0'
classpath 'org.robolectric:robolectric-gradle-plugin:0.11.0'
}
}
def isSnapshot() {
return VERSION_NAME.contains('SNAPSHOT')
}
def gradleMvnPush = new File(buildDir, 'gradle-mvn-push.gradle')
if (!gradleMvnPush.exists()) {
buildDir.mkdirs()
ant.get(src: GRADLE_MVN_PUSH, dest: gradleMvnPush)
}
setProperty('GRADLE_MVN_PUSH', gradleMvnPush)
subprojects {
group GROUP
version VERSION_NAME
apply plugin: 'android-sdk-manager'
if (name.startsWith('lib')) {
apply plugin: 'com.android.library'
} else {
apply plugin: 'com.android.application'
}
android {
compileSdkVersion COMPILE_SDK_VERSION as int
buildToolsVersion BUILD_TOOLS_VERSION
defaultConfig {
minSdkVersion MIN_SDK_VERSION as int
targetSdkVersion TARGET_SDK_VERSION as int
versionCode 1
versionName '1.0'
// workaround for https://code.google.com/p/android/issues/detail?id=52962
buildConfigField 'boolean', 'SNAPSHOT', isSnapshot().toString()
}
lintOptions {
abortOnError false
}
}
repositories {
mavenLocal()
mavenCentral()
}
if (isSnapshot()) {
apply plugin: 'robolectric'
dependencies {
// NOTE workaround for sdkmanager plugin
compile 'com.android.support:support-v4:19.0.1'
androidTestCompile 'junit:junit:4.10'
androidTestCompile 'org.robolectric:robolectric:2.3'
androidTestCompile 'com.squareup:fest-android:1.0.8'
}
}
}
F-A-B/AndroidManifest.xml中(這裏可能是一個線索,我(想)大膽了,使Android的工作室已經變成了紅色區域
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=" **http://schemas.android.com/apk/res/android** "
package="com.shamanland.fab.example">
<application
android:name=" **.ExampleApplication** "
android:label="@string/app_name"
**android:icon** ="@drawable/ic_launcher"
**android:theme** ="@style/AppTheme"
**android:allowBackup** ="true"
>
<activity android:name=".ExampleListActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name=" **.ExampleDetailsActivity** "/>
</application>
</manifest>
我有一個強烈的懷疑該子模塊被錯誤地添加。
真的,我想要的是在我的應用中使用晶圓廠,如果任何人都可以幫我弄清楚什麼可能是錯誤的,添加子模塊,或者用我的build.gradle,真的會感激!
我在我的Nexus 7上測試設備,運行4.4.4 – Kelsey 2014-11-03 08:13:27
4.4.4是API級別19.在您的「build.gradle」文件中,您已將「minSdkVersion」設置爲21.一個APK生成方式不會在4.4.4設備上運行。只需更改您的「build.gradle」即可使用API級別19. - AndroidGuy 19分鐘前 – AndroidGuy 2014-11-03 19:28:05
奇怪的是,在我的設備上一切正常,我沒有碰過app/build.gradle。只是在添加子模塊後才發現錯誤 – Kelsey 2014-11-09 10:48:49