简体   繁体   English

如何解决这个Gradle Build问题?

[英]How to resolve this Gradle Build issue?

I am creating an Android App and I need drag and move feature. 我正在创建一个Android应用程序,并且需要拖放功能。 So, for that, I found a library named "Advanced RecyclerView". 因此,为此,我找到了一个名为“ Advanced RecyclerView”的库。

So I tried to add the above library using Gradle for Android. 因此,我尝试使用Android的Gradle添加上述库。

The lines are: 这些行是:

dependencies {
    implementation ('com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.11.0@aar'){
        transitive=true
    }
}

My Issue 我的问题

After adding these lines I got following error on Gradle Build: 添加这些行后,在Gradle Build上出现以下错误:

Error:Could not find com.android.support:recyclerview-v7:27.0.0. 错误:找不到com.android.support:recyclerview-v7:27.0.0。 Required by: Nuvo_Rider:app:unspecified Nuvo_Rider:app:unspecified > com.l4digital.fastscroll:fastscroll:1.0.4 Nuvo_Rider:app:unspecified > com.android.support:design:25.3.1 所需者:Nuvo_Rider:app:未指定Nuvo_Rider:app:未指定> com.l4digital.fastscroll:fastscroll:1.0.4 Nuvo_Rider:app:未指定> com.android.support:design:25.3.1

Please install the Android Support Repository from the Android SDK Manager. 请从Android SDK Manager安装Android支持存储库。 Open Android SDK Manager 打开Android SDK Manager

My steps to resolve I tried changing compileSDKversion to 27 and also added recyclerview.V27.0.2, but couldn't find a solution. 解决的步骤我尝试将compileSDKversion更改为27,还添加了recyclerview.V27.0.2,但找不到解决方案。

My Gradle: 我的摇篮:

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

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

apply plugin: 'com.neenbedankt.android-apt'
def AAVersion = '4.2.0'
def AndroidSupportVersion = '25.3.1'

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

    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
        classpath 'io.fabric.tools:gradle:1.21.6'
    }
}

android {
//    compileSdkVersion 25
//    buildToolsVersion "25.0.2"
    compileSdkVersion 24
    buildToolsVersion "25.0.1"

    defaultConfig {
        applicationId "com.nuvo.rider"
        minSdkVersion 19
        targetSdkVersion 25
        //versionCode 6
        //versionName "1.2.3"
        versionCode 11
        versionName "1.0"
        // Enabling multidex support.
        multiDexEnabled true
        // vector appCompact
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    useLibrary 'org.apache.http.legacy'
}

apt {
    arguments {
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    //Default
    //noinspection GradleCompatible
    //compile "com.android.support:appcompat-v7:$AndroidSupportVersion"
    // compile "com.android.support:design:$AndroidSupportVersion"
    compile "com.android.support:support-annotations:$AndroidSupportVersion"
    //Card View
    compile "com.android.support:cardview-v7:$AndroidSupportVersion"
    //Recyleerview
    compile "com.android.support:recyclerview-v7:$AndroidSupportVersion"
    //Annotation
    apt "org.androidannotations:androidannotations:$AAVersion"
    compile "org.androidannotations:androidannotations-api:$AAVersion"

    //Stripe
    compile('com.stripe:stripe-android:1.0.4@aar') {
        transitive = true;
    }
    //Fabric
    compile('io.fabric.sdk.android:fabric:1.3.10@aar') {
        transitive = true;
    }

    //Crashlytics
    compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
        transitive = true;
    }

    compile('com.crashlytics.sdk.android:crashlytics-ndk:1.1.6@aar') {
        transitive = true;
    }

    //Scan Card
    //Multidex
    //Validator
    //EditText
    //Facebook SDK
    //Firebase & GeoFire
    //glide

    //Route Drawer
    //Top Snackbar
    //Universal Image Loader

    //Stripe
    compile('com.stripe:stripe-android:1.0.4@aar') {
        transitive = true;
    }
    //Fabric
    compile('io.fabric.sdk.android:fabric:1.3.10@aar') {
        transitive = true;
    }

    //Crashlytics
    compile('com.crashlytics.sdk.android:crashlytics:2.6.6@aar') {
        transitive = true;
    }

    //Volley

    compile('com.l4digital.fastscroll:fastscroll:1.0.4') {
        transitive = true;
    }
    compile('io.reactivex.rxjava2:rxandroid:2.0.1') {
        transitive = true;
        //    exclude group: 'universal-image-loader-1.9.5.jar';
    }

    compile ('com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.11.0@aar'){
        transitive=true
    }
    compile 'com.android.support:appcompat-v7:24.2.1'
    compile 'com.android.support:design:24.2.1'
    compile 'com.google.android.gms:play-services:10.2.0'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.mobsandgeeks:android-saripaar:2.0.2'
    compile 'com.rengwuxian.materialedittext:library:2.1.4'
    compile 'com.facebook.android:facebook-android-sdk:4.1.2'
    compile 'com.google.firebase:firebase-core:10.0.1'
    compile 'com.google.firebase:firebase-database:10.0.1'
    compile 'com.firebase:geofire-android:2.1.1'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.jaredrummler:material-spinner:1.1.0'
    compile 'com.akexorcist:googledirectionlibrary:1.0.5'
    compile 'com.androidadvance:topsnackbar:1.1.1'
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
    compile 'cn.pedant.sweetalert:library:1.3'
    compile 'com.mcxiaoke.volley:library:1.0.19'
    compile 'com.squareup.okhttp3:okhttp:3.6.0'
    compile 'io.card:android-sdk:5.5.0'
    compile 'com.wdullaer:materialdatetimepicker:3.1.2'
    compile 'com.googlecode.libphonenumber:libphonenumber:8.7.0'
    compile 'com.android.support:support-v4:25.3.0'
    compile 'com.kyleduo.switchbutton:library:1.4.6'
    compile 'com.cocosw:bottomsheet:1.+@aar'
    compile 'com.squareup.retrofit2:retrofit:2.3.0'
    compile 'com.squareup.retrofit2:converter-gson:2.3.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'net.authorize:accept-sdk-android:1.0.2'

}

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

crashlytics {
    enableNdk true
    androidNdkOut 'src/main/obj'
    androidNdkLibsOut 'src/main/libs'
}

Final Words 最后的话

Since I am new to Android, I can't fix this issue. 由于我不熟悉Android,因此无法解决此问题。

FOLLOW THE STEPS 按照步骤

Add the following lines of code into your build.gradle . 将以下代码行添加到build.gradle中

Step 1: 步骤1:

dependencies {
   implementation ('com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.11.0@aar'){
        transitive=true
    }
}

NOTE: This library is served on jCenter . 注意:该库在jCenter提供 If the above gradle setting not getting work, try adding the following lines. 如果以上gradle设置无法正常工作,请尝试添加以下行。

Step 2: 第2步:

repositories {
    jcenter()
}

ATTENTION: Make sure you Global Gradle Setting wasn't offline 注意:请确保您的全局Gradle设置未离线

Check it, 检查,

File > Setting > Build,Execution,Deployment > Gradle 文件>设置>构建,执行,部署> Gradle

If offline work checkbox is checked, then please uncheck it. 如果选中了offline work复选框,则请取消选中该复选框。

在此处输入图片说明 Try to Clean and Rebuild project. 尝试CleanRebuild项目。

use same versions check below 使用相同的版本,请在下面检查

       apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

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

apply plugin: 'com.neenbedankt.android-apt'
def AAVersion = '4.2.0'
def AndroidSupportVersion = '24.2.1' //change here

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

    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
        classpath 'io.fabric.tools:gradle:1.21.6'
    }
}

android {
//    compileSdkVersion 25
//    buildToolsVersion "25.0.2"
    compileSdkVersion 24
    buildToolsVersion "25.0.1"

    defaultConfig {
        applicationId "com.nuvo.rider"
        minSdkVersion 19
        targetSdkVersion 25
        //versionCode 6
        //versionName "1.2.3"
        versionCode 11
        versionName "1.0"
        // Enabling multidex support.
        multiDexEnabled true
        // vector appCompact
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    useLibrary 'org.apache.http.legacy'
}

apt {
    arguments {
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    //Default
    //noinspection GradleCompatible
    //compile "com.android.support:appcompat-v7:$AndroidSupportVersion"
    // compile "com.android.support:design:$AndroidSupportVersion"
    compile "com.android.support:support-annotations:$AndroidSupportVersion"
    //Card View
    compile "com.android.support:cardview-v7:$AndroidSupportVersion"
    //Recyleerview
    compile "com.android.support:recyclerview-v7:$AndroidSupportVersion"
    //Annotation
    apt "org.androidannotations:androidannotations:$AAVersion"
    compile "org.androidannotations:androidannotations-api:$AAVersion"

    //Stripe
    compile('com.stripe:stripe-android:1.0.4@aar') {
        transitive = true;
    }
    //Fabric
    compile('io.fabric.sdk.android:fabric:1.3.10@aar') {
        transitive = true;
    }

    //Crashlytics
    compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
        transitive = true;
    }

    compile('com.crashlytics.sdk.android:crashlytics-ndk:1.1.6@aar') {
        transitive = true;
    }

    //Scan Card
    //Multidex
    //Validator
    //EditText
    //Facebook SDK
    //Firebase & GeoFire
    //glide

    //Route Drawer
    //Top Snackbar
    //Universal Image Loader

    //Stripe
    compile('com.stripe:stripe-android:1.0.4@aar') {
        transitive = true;
    }
    //Fabric
    compile('io.fabric.sdk.android:fabric:1.3.10@aar') {
        transitive = true;
    }

    //Crashlytics
    compile('com.crashlytics.sdk.android:crashlytics:2.6.6@aar') {
        transitive = true;
    }

    //Volley

    compile('com.l4digital.fastscroll:fastscroll:1.0.4') {
        transitive = true;
    }
    compile('io.reactivex.rxjava2:rxandroid:2.0.1') {
        transitive = true;
        //    exclude group: 'universal-image-loader-1.9.5.jar';
    }

    compile ('com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.11.0@aar'){
        transitive=true
    }
    compile 'com.android.support:appcompat-v7:24.2.1'
    compile 'com.android.support:design:24.2.1'
    compile 'com.google.android.gms:play-services:10.2.0'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.mobsandgeeks:android-saripaar:2.0.2'
    compile 'com.rengwuxian.materialedittext:library:2.1.4'
    compile 'com.facebook.android:facebook-android-sdk:4.1.2'
    compile 'com.google.firebase:firebase-core:10.0.1'
    compile 'com.google.firebase:firebase-database:10.0.1'
    compile 'com.firebase:geofire-android:2.1.1'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.jaredrummler:material-spinner:1.1.0'
    compile 'com.akexorcist:googledirectionlibrary:1.0.5'
    compile 'com.androidadvance:topsnackbar:1.1.1'
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
    compile 'cn.pedant.sweetalert:library:1.3'
    compile 'com.mcxiaoke.volley:library:1.0.19'
    compile 'com.squareup.okhttp3:okhttp:3.6.0'
    compile 'io.card:android-sdk:5.5.0'
    compile 'com.wdullaer:materialdatetimepicker:3.1.2'
    compile 'com.googlecode.libphonenumber:libphonenumber:8.7.0'
    compile 'com.android.support:support-v4:24.2.1' //change here
    compile 'com.kyleduo.switchbutton:library:1.4.6'
    compile 'com.cocosw:bottomsheet:1.+@aar'
    compile 'com.squareup.retrofit2:retrofit:2.3.0'
    compile 'com.squareup.retrofit2:converter-gson:2.3.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'net.authorize:accept-sdk-android:1.0.2'

}

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

crashlytics {
    enableNdk true
    androidNdkOut 'src/main/obj'
    androidNdkLibsOut 'src/main/libs'
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM