2017-06-06 43 views
1

GlideライブラリのAndroidでcentercropプレースホルダエラーなどを解決できません。 また、新しいプロジェクトに滑空を使用しようとしましたが、そこに問題があります。 グライドライブラリを使用するには、これがすべて正しいか何かを追加する必要があります。Glideライブラリのcentercropプレースホルダエラーなどを解決できません。

プロジェクトbuild.gradel

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

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

    allprojects { 
     repositories { 
      jcenter { 
       url "http://jcenter.bintray.com/" 
      } 
      maven { 
       url "http://repo1.maven.org/maven2" 
      } 
     } 
    } 

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

アプリ-build.gradel

apply plugin: 'com.android.application' 

    android { 
     compileSdkVersion 25 
     buildToolsVersion "25.0.3" 
     defaultConfig { 
      applicationId "com.techweblearn.musicplayer" 
      minSdkVersion 15 
      targetSdkVersion 25 
      versionCode 1 
      versionName "1.0" 
      testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
      renderscriptTargetApi 20 
      renderscriptSupportModeEnabled true 
     } 
     buildTypes { 
      release { 
       minifyEnabled false 
       proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
      } 
     } 
    } 

    dependencies { 
     compile fileTree(dir: 'libs', include: ['*.jar']) 
     androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
      exclude group: 'com.android.support', module: 'support-annotations' 
     }) 
     compile 'com.github.bumptech.glide:glide:4.0.0-RC0' 
     annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0-RC0' 
     compile 'com.android.support:cardview-v7:25.3.1' 
     compile 'com.android.support:appcompat-v7:25.3.1' 
     compile 'com.android.support.constraint:constraint-layout:1.0.2' 
     compile 'com.android.support:support-v4:25.3.1' 
     testCompile 'junit:junit:4.12' 
    } 

' 
+0

ここで、スタックトレースまたはコンパイルエラーはありますか? – MatPag

+1

私は同じ問題を抱えていました。私が今までに見つけた唯一の解決策は、グライドバージョンを** com.github.bumptech.glideにダウングレードすることでした:グライド:3.8.0 ** – Guildschris

答えて

0

いたのと同じ問題が、いくつかは、ソリューション
あなたがグライドv4.3.0を使用する必要があります (新しいバージョンを発見した掘削した後、

1.これをあなたに追加します。トップレベルbuild.gradle

これは簡単なステップを実行することで、AndroidStudio 3.0.1に若干の問題があります。
repositories { 
    mavenCentral() 
    google() 
} 

2.モジュールに依存関係を追加レベルのbuild.gradle

implementation 'com.github.bumptech.glide:glide:4.3.0' 
annotationProcessor 'com.github.bumptech.glide:compiler:4.3.0' 

3. proguard-rules.pro

-keep public class * implements com.bumptech.glide.module.GlideModule 
-keep public class * extends com.bumptech.glide.module.AppGlideModule 
-keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** { 
**[] $VALUES; 
public *; 
} 
# for DexGuard only 
-keepresourcexmlelements manifest/application/[email protected]=GlideModule 

4にこれらProGuardのルールを追加するには、この些細なクラスを追加あなたのアプリはGlideAppクラスを生成するために

package com.example.myapp; 

import com.bumptech.glide.annotation.GlideModule; 
import com.bumptech.glide.module.AppGlideModule; 

@GlideModule 
public final class MyAppGlideModule extends AppGlideModule {} 

5.Clプロジェクトを構築してください。
6.完了!今度はGlideAppをcentercrop()メソッドで使用することができます

GlideApp 
    .with(myFragment) 
    .load(url) 
    .centerCrop() 
    .placeholder(R.drawable.loading_spinner) 
    .into(myImageView); 
関連する問題