【问题标题】:Not compile library file of Svg image Loader不编译 Svg 图像加载器的库文件
【发布时间】:2018-06-05 07:43:42
【问题描述】:

我在我的项目中编译了这个依赖:

compile 'com.github.ar-android:AndroidSvgLoader:1.0.1'

未正确同步并给出以下错误:

无法解析 ':app@debug/compileClasspath' 的依赖关系:可以 无法解析 com.github.ar-android:AndroidSvgLoader:1.0.1。

无法解决依赖关系 ':app@debug/compileClasspath': 无法解析 com.github.ar-android:AndroidSvgLoader:1.0.1。无法解决 app@debugAndroidTest/compileClasspath' 的依赖项:不能 解析 com.github.ar-android:AndroidSvgLoader:1.0.1。

无法解决依赖关系 app@debugAndroidTest/compileClasspath 无法解析 com.github.ar-android:AndroidSvgLoader:1.0.1

我也写依赖

    allprojects {
          repositories {
          google()
          jcenter()
           maven { url 'https://jitpack.io'; }
  // but still not working....
    }
    }

Gradle 文件:

项目文件

buildscript {

repositories {
    google()
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.1.1'


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

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

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

应用 Gradle 文件

     apply plugin: 'com.android.application'

 android {
 compileSdkVersion 26
  defaultConfig {
    applicationId "edru.techxpose.co.recycleviewdemo"
    minSdkVersion 15
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner 
 "android.support.test.runner.AndroidJUnitRunner"
  }
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 
 'proguard-rules.pro'
    }
  }
}

 dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')

implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'


implementation 'com.github.ar-android:AndroidSvgLoader:1.0.1'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
  androidTestImplementation 'com.android.support.test.espresso:espresso- 
 core:3.0.2'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.caverock:androidsvg:1.2.1'

implementation files('libs/svg-android-2.0.5.jar')
  }

【问题讨论】:

  • 请正确格式化您的问题。

标签: android svg android-gradle-plugin


【解决方案1】:

试试这个代码:

项目文件:

buildscript {

    repositories {
        maven { url 'https://jitpack.io' }
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'


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

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

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

应用 Gradle 文件

     apply plugin: 'com.android.application'

 android {
 compileSdkVersion 26
  defaultConfig {
    applicationId "edru.techxpose.co.recycleviewdemo"
    minSdkVersion 15
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner 
 "android.support.test.runner.AndroidJUnitRunner"
  }
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 
 'proguard-rules.pro'
    }
  }
}

 dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')

implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'


implementation 'com.github.ar-android:AndroidSvgLoader:1.0.1'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.caverock:androidsvg:1.2.1'
implementation files('libs/svg-android-2.0.5.jar')
  }

【讨论】:

  • 不工作。仍然面临同样的问题
  • @HarwinderSingh 请复制粘贴您的 2 个大文件,以便我们为您提供帮助。
  • @HarwinderSingh 尝试此代码并再次同步项目,如果您看到相同的错误,请尝试 File -> Invalidate Caches/Restart。告诉我它是否工作
  • @HarwinderSingh 如果可能,请点赞,非常感谢,祝您编码愉快
  • 我又遇到了一个问题。请修复它
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-05-12
  • 2015-08-12
  • 1970-01-01
  • 2018-03-01
  • 1970-01-01
  • 2015-10-20
相关资源
最近更新 更多