2016-09-30 54 views
5

错误:配置项目':app'时发生问题。找不到support-v4.jar(com.android.support:support-v4:24.0.0)

Could not find support-v4.jar (com.android.support:support-v4:24.0.0). Searched in the following locations: https://jcenter.bintray.com/com/android/support/support-v4/24.0.0/support-v4-24.0.0.jar

我的SDK工具是这样的形象

enter image description here

我的摇篮是

buildscript { 
    repositories { 
     maven { url 'https://maven.fabric.io/public' } 
    } 

    dependencies { 
     classpath 'io.fabric.tools:gradle:1.+' 
    } 
} 
apply plugin: 'com.android.application' 
apply plugin: 'io.fabric' 

repositories { 
    maven { url 'https://maven.fabric.io/public' } 
} 



android { 

    compileSdkVersion 24 
    buildToolsVersion "24" 

    dexOptions { 
     javaMaxHeapSize "4g" //specify the heap size for the dex process 
     preDexLibraries = false //delete the already predexed libraries 
    } 


    defaultConfig { 
     applicationId "com.lionvisionsits.kkasons" 
     minSdkVersion 19 
     targetSdkVersion 24 

     multiDexEnabled false 

    } 


dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:24.0.0' 
    compile('com.digits.sdk.android:digits:[email protected]') { 
     transitive = true; 
    } 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    compile 'com.android.support:cardview-v7:24.0.0' 
    compile 'com.android.support:design:24.0.0' 
    compile 'com.android.support:recyclerview-v7:24.0.0' 
    compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2' 
    compile 'com.android.support:multidex:1.0.1' 
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5' 
    compile 'com.google.code.gson:gson:2.4' 
    compile 'com.google.android.gms:play-services:9.4.0' 
    compile 'com.google.firebase:firebase-messaging:9.4.0' 
    compile 'ch.acra:acra:4.9.0' 
    compile 'com.github.bumptech.glide:glide:3.7.0' 
    compile 'me.relex:circleindicator:[email protected]' 
    compile 'com.github.arimorty:floatingsearchview:2.0.3' 
    compile('com.digits.sdk.android:digits:[email protected]') { 
     transitive = true; 
    } 
    compile 'com.android.support:support-v4:24.0.0' 
} 

apply plugin: 'com.google.gms.google-services' 

谁能帮助我?

更新至v24.2.1我在调试得到这个错误\ AndroidMenifest.xml enter image description here

感谢后&问候 周杰伦

+1

奇怪的问题。此库不在jcenter中,但在本地maven repo.Try来更新SDK管理器并使用compile'c​​om.android.support:support-v4:24.2.1 –

+0

感谢您的答复。我试过24.2.1,但它在AndroidMenifest.xml中抛出错误。让我为此发送详细信息。 – Jay

+0

我增加了屏幕截图... ple。看看它@GabrieleMariotti – Jay

回答

0

没有在AndroidManifest.xml需要使用buildVersionCodename。您可以在应用build.gradle文件中更好地定义它。如下图所示:

defaultConfig { 
    applicationId "com.example.r" 
    minSdkVersion 15 
    versionCode 418 
    versionName "4.4.0" 

} 
5

我有同样的问题,我更新:

classpath 'com.android.tools.build:gradle:2.+' 

和我gradle这个包装

distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip 

和它的作品

+0

为我工作,谢谢! – BigPun86

0

可能的com.android.support:support-v4:24.0.0的版本不同于android studio。你可以尝试这样做:File-> project structure->app->dependencies->+->Library dependency,选择com.android.support:support-v4:xx.x.x。如果有任何问题,您可以将库更改为最新版本。

2

我有同样的问题,以下步骤解决了我的问题。给它尝试,看看是否有帮助:

enter image description here

转至 “文件” - > “项目结构...”。

在“模块”下选择“您的项目”,然后单击“依赖项”选项卡。

点击“+”号并选择“1 Library dependency”。

enter image description here

在新弹出的窗口中,选择 “支持-V4”,然后单击 “确定”。

0

试试这个里面android

compileOptions { 
    sourceCompatibility = JavaVersion.VERSION_1_7 
    targetCompatibility = JavaVersion.VERSION_1_7 
} 

或者,如果你有model块那就试试这个

compileOptions.with { 
    sourceCompatibility = JavaVersion.VERSION_1_7 
    targetCompatibility = JavaVersion.VERSION_1_7 
}