【问题标题】:Importing an eclipse project in android studio giving problems在android studio中导入eclipse项目会出现问题
【发布时间】:2015-11-21 14:26:49
【问题描述】:

我正在尝试在 android studio 中导入一个 eclipse android 项目,但它给了我以下错误。请给我解决方案,因为我无法理解错误背后的原因和建议的解决方案:

Information:Gradle tasks [:main:generateDebugSources, :main:generateDebugAndroidTestSources, :gunAlert:generateDebugSources, :gunAlert:generateDebugAndroidTestSources, :ffmpeg4android_lib:generateDebugSources, :ffmpeg4android_lib:generateDebugAndroidTestSources]
:main:preBuild UP-TO-DATE
:main:preDebugBuild UP-TO-DATE
:main:checkDebugManifest
:main:preDebugAndroidTestBuild UP-TO-DATE
:main:preDebugUnitTestBuild UP-TO-DATE
:main:preReleaseBuild UP-TO-DATE
:main:preReleaseUnitTestBuild UP-TO-DATE
:main:prepareComAndroidSupportAppcompatV71800Library
:main:prepareDebugDependencies
:main:compileDebugAidl
:main:compileDebugRenderscript
:main:generateDebugBuildConfig
:main:generateDebugAssets UP-TO-DATE
:main:mergeDebugAssets
:main:generateDebugResValues
:main:generateDebugResources
:main:mergeDebugResources
:main:processDebugManifest
:main:processDebugResources
:main:generateDebugSources
:main:prepareDebugAndroidTestDependencies
:main:compileDebugAndroidTestAidl
:main:compileLint
:main:copyDebugLint UP-TO-DATE
:main:mergeDebugProguardFiles
:main:processDebugJavaRes UP-TO-DATE
:main:compileDebugJava
:main:packageDebugJar
:main:compileDebugNdk UP-TO-DATE
:main:packageDebugJniLibs UP-TO-DATE
:main:packageDebugLocalJar UP-TO-DATE
:main:packageDebugRenderscript UP-TO-DATE
:main:packageDebugResources
:main:bundleDebug
:main:compileDebugSources
:main:assembleDebug
:main:processDebugAndroidTestManifest
/home/vipulbansal/Desktop/Projects/GunAlert5/main/build/intermediates/manifests/tmp/manifestMerger2276692237948654021.xml
Error:(5, 5) uses-sdk:minSdkVersion 1 cannot be smaller than version 7 declared in library /home/vipulbansal/Desktop/Projects/GunAlert5/main/build/intermediates/exploded-aar/com.android.support/appcompat-v7/18.0.0/AndroidManifest.xml
    Suggestion: use tools:overrideLibrary="android.support.v7.appcompat" to force usage
Error:Execution failed for task ':main:processDebugAndroidTestManifest'.
> java.lang.RuntimeException: Manifest merger failed : uses-sdk:minSdkVersion 1 cannot be smaller than version 7 declared in library /home/vipulbansal/Desktop/Projects/GunAlert5/main/build/intermediates/exploded-aar/com.android.support/appcompat-v7/18.0.0/AndroidManifest.xml
    Suggestion: use tools:overrideLibrary="android.support.v7.appcompat" to force usage
Information:BUILD FAILED
Information:Total time: 1.63 secs
Information:2 errors
Information:0 warnings
Information:See complete output in console

【问题讨论】:

  • 您是否阅读过错误信息?它们非常具有解释性......
  • 我有。在哪里使用工具:overrideLibrary="android.support.v7.appcompat" ?
  • 在xml元素中添加这个属性(可能是mainfest中的)报错信息。 xmlns:tools="http://schemas.android.com/tools"
  • 您使用的是哪个版本的 SDK 和 Android 支持库?也许您正在使用 Android 支持库的过时版本。打开 SDK 管理器并更新到最新版本...只是猜测...
  • 现在,在完成所有操作后,它在 appcompat v7 中给了我错误

标签: android android-studio android-gradle-plugin android-support-library android-appcompat


【解决方案1】:

由于您在项目中使用 app-compat 库,
您必须使用 minSdkVersion >=7,因为 app-compat 具有 minSdk = 7。

在您的build.gradle 中,您必须声明 minSdk。 如果不存在,默认值为 1,这就是您的问题的原因。

在你的 build.gradle 中:

android {
    compileSdkVersion XX
    buildToolsVersion "XX.X.X"

    defaultConfig {
        minSdkVersion 7  //or more

        applicationId "xxxxxx"            
        targetSdkVersion XX
        versionCode X
        versionName "XX"
    }

}

【讨论】:

    猜你喜欢
    • 2017-07-22
    • 2016-06-21
    • 2011-05-03
    • 1970-01-01
    • 1970-01-01
    • 2011-03-19
    • 2018-01-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多