清单合并失败:uses-sdk:minSdkVersion 1不能小于库中声明的版本14

时间:2017-10-24 19:52:12

标签: android gradle android-gradle google-play-services android-manifest

我在过去5-7小时内一直在搜索SO和其他Android博客,以摆脱一个错误但不能。 在Android Studio中,我导入了一个旧的eclipse项目,但错误" Manifest合并失败了#39;坚持像

Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 1 cannot be smaller than version 14 declared in library [com.google.android.gms:play-services:11.0.4] C:\Users\.android\build-cache\857c11d37cd8661c3d52cb060657f8bf3635bb7a\output\AndroidManifest.xml
    Suggestion: use tools:overrideLibrary="com.google.android.gms.play_services" to force usage

当我检查在build.gradle中提到minSdkVersion然后我得到 Gradle构建完成了227错误,1m 30s 253ms 一些错误是:

    Z:\#1 ready\others\UVPlayermasterpart1\HoppingBird\app\build\intermediates\res\merged\debug\values-ldltr-v21\values-ldltr-v21.xml
    Z:\#1 ready\others\UVPlayermasterpart1\HoppingBird\app\build\intermediates\res\merged\debug\values-v21\values-v21.xml
Error:(17) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Inverse'.
Error:(19) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large.Inverse'.
Error:(280) Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Material.Light.DialogWhenLarge.NoActionBar'.
Error:(27) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.SearchResult.Subtitle'.
Error:(106, 21) No resource found that matches the given name: attr 'android:colorAccent'.
.
.
.
.Error:(203, 21) No resource found that matches the given name: attr 'android:overlapAnchor'.
.
.

并且在清单文件中使用overrideLibrary不起作用。

的build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 19
    buildToolsVersion "26.0.2"

    defaultConfig {
        applicationId "bb.hoppingbird"
        //minSdkVersion 14
        //targetSdkVersion 19
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:support-v4:19.1.0'
    compile 'com.google.android.gms:play-services:+'
}

的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="bb.hoppingbird"
    android:versionCode="1"
    android:versionName="1.0">

    <supports-screens
        android:xlargeScreens="true"
        android:largeScreens="true"
        android:normalScreens="true"
        android:smallScreens="true"
        android:anyDensity="false" />

    <application
        android:icon="@drawable/icon"
        android:label="@string/app_name">

        <activity
            android:name="bb.hoppingbird.MainActivity"
            android:label="@string/app_name"
            android:screenOrientation="landscape"
            android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
            android:configChanges="orientation">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <!-- Ads Using Google Play Services SDK -->
        <meta-data android:name="com.google.android.gms.version"
               android:value="@integer/google_play_services_version"/>

        <activity android:name="com.google.android.gms.ads.AdActivity"
             android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
    </application>

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.RESTART_PACKAGES"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />

</manifest>

我将非常感谢您的回答。 谢谢

3 个答案:

答案 0 :(得分:1)

你应该改变:

 Applying gsc.0004_auto_20171024_1916...Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/Quentin/git/myapp/myapp_env/lib/python3.6/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/Users/Quentin/git/myapp/myapp_env/lib/python3.6/site-packages/django/core/management/__init__.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/Quentin/git/myapp/myapp_env/lib/python3.6/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Users/Quentin/git/myapp/myapp_env/lib/python3.6/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "/Users/Quentin/git/myapp/myapp_env/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 204, in handle
    fake_initial=fake_initial,
  File "/Users/Quentin/git/myapp/myapp_env/lib/python3.6/site-packages/django/db/migrations/executor.py", line 115, in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "/Users/Quentin/git/myapp/myapp_env/lib/python3.6/site-packages/django/db/migrations/executor.py", line 145, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "/Users/Quentin/git/myapp/myapp_env/lib/python3.6/site-packages/django/db/migrations/executor.py", line 244, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/Users/Quentin/git/myapp/myapp_env/lib/python3.6/site-packages/django/db/migrations/migration.py", line 129, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/Users/Quentin/git/myapp/myapp_env/lib/python3.6/site-packages/django/db/migrations/operations/fields.py", line 87, in database_forwards
    field,
  File "/Users/Quentin/git/myapp/myapp_env/lib/python3.6/site-packages/django/db/backends/sqlite3/schema.py", line 238, in add_field
    self._remake_table(model, create_field=field)
  File "/Users/Quentin/git/myapp/myapp_env/lib/python3.6/site-packages/django/db/backends/sqlite3/schema.py", line 113, in _remake_table
    self.effective_default(create_field)
  File "/Users/Quentin/git/myapp/myapp_env/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 229, in effective_default
    default = field.get_db_prep_save(default, self.connection)
  File "/Users/Quentin/git/myapp/myapp_env/lib/python3.6/site-packages/django/db/models/fields/__init__.py", line 770, in get_db_prep_save
    prepared=False)
  File "/Users/Quentin/git/myapp/myapp_env/lib/python3.6/site-packages/django/db/models/fields/__init__.py", line 762, in get_db_prep_value
    value = self.get_prep_value(value)
  File "/Users/Quentin/git/myapp/myapp_env/lib/python3.6/site-packages/django/db/models/fields/__init__.py", line 1781, in get_prep_value
    return float(value)
ValueError: could not convert string to float: 

为:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 19
    buildToolsVersion "26.0.2"

    defaultConfig {
        applicationId "bb.hoppingbird"
        //minSdkVersion 14
        //targetSdkVersion 19
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:support-v4:19.1.0'
    compile 'com.google.android.gms:play-services:+'
}

更新: 请按照以下说明操作:

答案 1 :(得分:1)

如果您在项目中使用AppCompatActivity,则需要进行更改 build.gradel文件中com.android.support:appcompat-v7:26.1.0的minSdkVersion 14

    minSdkVersion 14
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"

答案 2 :(得分:0)

任何来自 libGDX 的人,在您的 game-project/android/build.gradle 中将您的 minSdkVersion 从 14 更改为 16。例如:

defaultConfig {
// other config options...
    minSdkVersion 16
}