总是无法解决support-v4

时间:2018-07-17 18:13:52

标签: android android-gradle

我同时在两台计算机(Mac和Windows)中工作。和两台机器上的android studio配置相似。在Mac中,相同的代码运行正常,但在Windows中始终会生成错误“无法解析support-v4”。卡在这里,需要解决方案。我已经使用sdk管理器删除了支持存储库,然后重新安装,但是没有运气。我的支持库版本是27.1.1。下面我给两个build.gradle文件。请给我建议或提示以解决此问题

我的项目级别build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
    jcenter()
    google()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.1.3'
    classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
    classpath 'com.google.gms:google-services:4.0.1'

    classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
    classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3"

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

allprojects {
repositories {
    jcenter()
    maven { url 'https://maven.google.com' }
    google()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

ext {
minSdkVersion = 19
targetSdkVersion = 27
compileSdkVersion = 27
buildToolsVersion = '27.0.3'
supportLibraryVersion = '27.1.1'
daggerVersion = '2.5'
retrofitVersion = '2.4.0'

rxJavaVersion = '2.1.13'
rxAndroidVersion = '2.0.2'

butterknifeVersion = '8.8.1'
loggerVersion = '3.4.1'
annotationVersion = '10.0-b28'
timberVersion = '4.7.0'
crashVersion = '2.6.2'
constraintLayoutVersion = '1.1.2'

fbAccountKitVersion = '4.+'
firebaseMessagingVersion = '17.1.0'
firebaseCoreVersion = '16.0.1'
playServiceVersion = '15.0.1'

picassoVersion = '2.71828'
eventBusVersion = '3.0.0'

tedBottomPickerVersion = '1.1.0'
tedPermissionVersion = '2.2.0'

}

我的应用程序级别buil.gradle文件是

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'

android {
signingConfigs {
    release {
        keyAlias '******'
        keyPassword '********'
        storeFile file('keystore/******.jks')
        storePassword '******'
    }
}

compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

//app versioning
def versionMajor = 1
def versionMinor = 1
def versionPatch = 0
def versionBuild = 3

defaultConfig {
    applicationId "project.passenger.oye.flow.oyebuddy"
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    versionCode versionMajor * 10000 + versionMinor * 1000 + versionPatch * 100 + versionBuild
    versionName "${versionMajor}.${versionMinor}.${versionPatch}-Build-${versionBuild}"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    // Enabling multiDex support.
    multiDexEnabled true

    vectorDrawables.useSupportLibrary = true

}
buildTypes {
    debug {
        minifyEnabled false
        shrinkResources false

        debuggable true

    }
    release {
        minifyEnabled true
        shrinkResources true
        proguardFiles getDefaultProguardFile('proguard-android.txt'),
                'proguard-rules.pro'

        signingConfig signingConfigs.release

    }
}

// Specifies flavor dimensions.
flavorDimensions "countryWise"

productFlavors {

    bangladeshFlavor {
        applicationId "project.passenger.oye.flow.oyebuddy"
        versionNameSuffix "-bd"
        dimension "countryWise"
    }
    nepalFlavor {
        applicationId "project.passenger.oye.flow.oyebuddy.nepal"
        versionNameSuffix "-nepal"
        dimension "countryWise"
    }
}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

packagingOptions.excludes = [
        'META-INF/DEPENDENCIES',
        'META-INF/LICENSE',
        'META-INF/LICENSE.txt',
        'LICENSE.txt',
        'LICENSE',
        'META-INF/license.txt',
        'META-INF/NOTICE',
        'NOTICE',
        'asm-license.txt',
        'META-INF/NOTICE.txt',
        'META-INF/notice.txt',
        'META-INF/ASL2.0',
        'META-INF/MANIFEST.MF'
]
}

repositories {
jcenter()
mavenCentral()
maven {
    url "https://jitpack.io"
}
maven { url 'https://maven.fabric.io/public' }
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:multidex:1.0.3'

implementation project(':myDirectionLib')
implementation "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion"
implementation "com.android.support:design:$rootProject.supportLibraryVersion"
implementation "com.android.support:cardview-v7:$rootProject.supportLibraryVersion"

//cons layout
implementation "com.android.support.constraint:constraint-layout:$rootProject.constraintLayoutVersion"

//due to mixed version
implementation "com.android.support:palette-v7:$rootProject.supportLibraryVersion"
implementation "com.android.support:mediarouter-v7:$rootProject.supportLibraryVersion"
implementation "com.android.support:exifinterface:$rootProject.supportLibraryVersion"

//account kit facebook
implementation "com.facebook.android:account-kit-sdk:$rootProject.fbAccountKitVersion"
compileOnly "org.glassfish:javax.annotation:$rootProject.ext.annotationVersion"

//dagger2
implementation "com.google.dagger:dagger:$rootProject.daggerVersion"

annotationProcessor "com.google.dagger:dagger-compiler:$rootProject.daggerVersion"

//retrofit2 / okhttp3
implementation "com.squareup.retrofit2:retrofit:$rootProject.ext.retrofitVersion"
implementation "com.squareup.retrofit2:converter-gson:$rootProject.ext.retrofitVersion"
implementation "com.squareup.retrofit2:adapter-rxjava2:$rootProject.ext.retrofitVersion"

implementation "com.squareup.okhttp3:okhttp:$rootProject.ext.loggerVersion"
implementation "com.squareup.okhttp3:logging-interceptor:$rootProject.ext.loggerVersion"

//rxjava2
implementation "io.reactivex.rxjava2:rxjava:$rootProject.ext.rxJavaVersion"
implementation "io.reactivex.rxjava2:rxandroid:$rootProject.ext.rxAndroidVersion"

//butterknife
implementation "com.jakewharton:butterknife:$rootProject.ext.butterknifeVersion"
annotationProcessor "com.jakewharton:butterknife-compiler:$rootProject.ext.butterknifeVersion"

//logger
implementation "com.jakewharton.timber:timber:$rootProject.ext.timberVersion"

//play service
implementation "com.google.android.gms:play-services-location:$rootProject.ext.playServiceVersion"
implementation "com.google.android.gms:play-services-maps:$rootProject.ext.playServiceVersion"
implementation "com.google.android.gms:play-services-places:$rootProject.ext.playServiceVersion"

//due to mixed version
implementation "com.google.android.gms:play-services-auth:$rootProject.ext.playServiceVersion"
implementation "com.google.android.gms:play-services-auth-api-phone:$rootProject.ext.playServiceVersion"
implementation "com.google.android.gms:play-services-auth-base:$rootProject.ext.playServiceVersion"

//firebase / fcm
implementation "com.google.firebase:firebase-core:$rootProject.ext.firebaseCoreVersion"
implementation "com.google.firebase:firebase-messaging:$rootProject.ext.firebaseMessagingVersion"

// fabric / crashlytics
implementation("com.crashlytics.sdk.android:crashlytics:$rootProject.ext.crashVersion@aar") {
    transitive = true
}

//image loading / imageview
implementation "com.squareup.picasso:picasso:$rootProject.ext.picassoVersion"
implementation 'cn.gavinliu.android.lib:ShapedImageView:0.8.5'

//event bus
implementation "org.greenrobot:eventbus:$rootProject.ext.eventBusVersion"

//for image picker single/multiple mode
implementation "gun0912.ted:tedbottompicker:$rootProject.ext.tedBottomPickerVersion"

//for permission listener
implementation "gun0912.ted:tedpermission:$rootProject.ext.tedPermissionVersion"



}

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

0 个答案:

没有答案