【问题标题】:Getting issue with Android development遇到Android开发问题
【发布时间】:2015-01-30 06:45:08
【问题描述】:

请参阅以下附加屏幕截图。我将尝试添加 android-v4 jar 文件,但在 android stdio 中遇到问题(在 Android stdio 中,通过导入项目功能添加)

导入 jar 文件时 den 出现以下错误。

build.gradle (Module::App) 文件在这里

android {
    compileSdkVersion 13
    buildToolsVersion "21.1.2"
    defaultConfig {
        applicationId "com.jigsaw.startup"
        minSdkVersion 10
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    //    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.gms:play-services:6.5.87'
    compile 'com.android.support:appcompat-v7:21.0.3'
    compile 'com.google.code.gson:gson:2.2.4'
    compile 'com.loopj.android:android-async-http:1.4.6'
    compile 'com.android.support:support-v4:21.0.3'alert    
}


configurations {
    all*.exclude group: 'com.android.support', module: 'support-v4'

如果有人需要任何额外信息,请告诉我。

【问题讨论】:

  • 应用模块的 build.gradle 文件。
  • 试试这个链接兄弟*.com/questions/16580586/…你不需要像链接中描述的那样在你的gradle构建脚本中导入jar文件添加依赖。
  • @Vigneshearan.m ...谢谢伙计!但我已经尝试过了....但它给了我红色警报。所以我删除了它。我已经附加了我的 build.gradle 文件
  • 您是从 Eclipse 导入项目吗?
  • 好的,知道了。让我改变它。 @Spidy

标签: android android-studio


【解决方案1】:

构建脚本中的这条语句:

configurations {
    all*.exclude group: 'com.android.support', module: 'support-v4'
}

明确排除 com.android.support.v4 中的任何内容链接到您的项目,这就是 import com.android.support.v4.Fragment 语句不起作用的原因。删除它,导入应该没问题。

【讨论】:

    【解决方案2】:

    我更改了 android API 并在 Andoid 4.2 上工作。然后问题解决了。

    谢谢大家

    【讨论】: