错误:未能解析:com.github.bumptech.glide:glide:4.0.0-SNAPSHOT

7

Build.gradle(Module:App)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion '23.0.3'

    defaultConfig {
        applicationId "com.example.beetel.App"
        minSdkVersion 21
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"



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

}
repositories {
    mavenCentral() // jcenter() works as well because it pulls from Maven Central
   maven{ url "https://jitpack.io"}
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    //glide libraries
    compile 'com.android.support:palette-v7:23.3.0'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.github.florent37:glidepalette:2.0.0'
    compile 'com.github.bumptech.glide:okhttp-integration:1.3.1@aar'
    //            { transitive = true;}
    //            { exclude group: 'com.squareup.okhttp';}
    //compile 'com.google.code.gson:gson:2.6.1'
    //retrofit,square,rxjava libraries
    compile 'com.squareup.retrofit2:retrofit:2.0.0-beta4'
    compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4'
    compile 'io.reactivex:rxjava:1.1.1'
    compile 'io.reactivex:rxandroid:1.1.0'
    compile 'com.squareup.retrofit2:adapter-rxjava:2.0.0-beta4'
    //android support libraries
    compile 'com.android.support:appcompat-v7:23.3.0'
    //    compile'com.android.support:appcompat-v4:23.2.0'
    //    compile 'net.steamcrafted:materialiconlib:1.0.9'
    compile 'com.android.support:design:23.3.0'
    compile 'com.android.support:support-v4:23.3.0'
    compile 'com.android.support:cardview-v7:23.3.0'
    compile 'com.android.support:recyclerview-v7:23.3.0'
    //    compile project(':AndroidBootstrap')
    compile 'com.jakewharton:butterknife:7.0.1'
    compile 'com.github.jd-alexander:LikeButton:0.1.8'
    compile 'com.facebook.stetho:stetho-okhttp3:1.3.0'
    compile 'com.facebook.stetho:stetho-okhttp:1.3.0'
}

Build.gradle (Project:App):

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

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

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

allprojects {
    repositories {
        jcenter()
//        maven{
//           url "https://oss.sonatype.org/content/repositories/snapshots"}
//        maven
//                {
//                    url "http://dl.bintray.com/florent37/maven"
//
//                }

        }
    }


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

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.beetel.App">
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <application
        android:allowBackup="true"
        android:largeHeap="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <meta-data android:name="com.example.beetel.App.utilities.ConfigGlide"
            android:value="GlideModule"/>
        <provider
            android:authorities="com.example.beetel.App."
            android:name="com.example.beetel.App.data.model.MoProvider"/>
        <activity android:name="com.example.beetel.App.MainActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.Main">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <activity android:name="com.example.beetel.App.MoDActivity"
            android:label="@string/title_activity_modetails"
            android:parentActivityName="com.example.beetel.App.MainActivity"
            android:theme="@style/AppTheme.Detail">
            <meta-data android:name="android.support.PARENT_ACTIVITY"
                android:value="com.example.beetel.App.MainActivity"/>
        </activity>

    </application>

</manifest>

我不明白为什么错误一再出现? 我想要使用Glide Palette实现更有效的UI。 我尝试了无效缓存/重新启动、重建项目、清理项目等操作。 请帮帮我...我卡在这里,无法进一步调试。截止日期即将到来... 提前致谢!

Gradle构建后的消息 Gradle构建后的消息


有人遇到 Glide 相关的类似问题吗? - PN10
4个回答

4
在Build.gradle文件(项目app)中添加以下内容:
allprojects {
repositories {
    jcenter {
        url "http://jcenter.bintray.com/"
    }
    maven  {
        url "http://repo1.maven.org/maven2"
    }
  }
}

在Build.gradle(Module app)中添加依赖项com.github.bumptech.glide:glide:3.7.0
dependencies {

...
compile 'com.github.bumptech.glide:glide:3.7.0'

compile 'com.android.support:appcompat-v7:24.0.0-beta1'
...

}

我之前已经尝试过了,但没有帮助。请查看我添加的图片,这可能有助于您更好地理解问题。我会等待您的回复。 - PN10

3

我也遇到了同样的错误。将以下行添加到存储库中并同步项目。

对我来说起作用就像魅力一样。

repositories {
              mavenCentral()

              jcenter() 
              if (project.hasProperty('local.repo'))
              {
                maven { name 'glide-local'; url project.property('local.repo') }
              } 
              maven { name 'glide-snapshot'; url 'http://oss.sonatype.org/content/repositories/snapshots' }
              flatDir name: 'libs', dirs: 'libs'
             maven 
             {
                url "https://jitpack.io"
             }
 }

谢谢,它确实有助于解决快照问题,但是出现了其他与Glide相关的问题...例如Error:error: cannot find symbol method centerCrop(),Error: cannot find symbol method error(int),Error: cannot find symbol method diskCacheStrategy(DiskCacheStrategy)(注意:与Glide API相关的某些方法不起作用)...你是否遇到过这些问题? - PN10
是的,我遇到过这个问题!对于中心裁剪,我更改了图像视图的xml属性scaleType为centerCrop android:scaleType="centerCrop" 但是我不知道diskCacheStrategy,因为我从未使用过它。 - Mohammad Aasif
我的情况与你不同,我在使用Glide库官方自述文档中所解释的Glide方法时遇到了这个问题。我认为这是Glide库在我的情况下出现的一些问题。如果我发现任何关于你的问题的信息,我会及时更新给你。祝编码愉快! - PN10
@PN10 我也遇到了同样的问题,你找到解决方案了吗? - Nobody
@Nobody 我已经解决了这个问题,但我不太记得具体是怎么解决的。我认为问题出在快照版本上,所以我删除了快照依赖项并检查了链接,这可能会有所帮助:http://bumptech.github.io/glide/dev/snapshots.html 和 http://bumptech.github.io/glide/doc/download-setup.html。 - PN10

2
我曾经遇到了这个问题,通过在build.gradle(Module: app)文件中添加以下内容解决了它。
repositories {
    mavenCentral() // jcenter() works as well because it pulls from Maven Central
}

并且它已经修复了


1
我有这个问题。如果你遇到这个错误,那是因为你需要使用jitpack.io来使用-SNAPSHOT。
所以你只需复制以下内容:
    maven { url 'https://jitpack.io' }

在你的文件 build.gradle(Module: app) 中,如果你从未修改过它,它应该是这样的:

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

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 {
    google()
    jcenter()
    maven { url 'https://jitpack.io' }
}
}

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接