web-dev-qa-db-ja.com

Android StudioでassembleReleaseを使用してapkをコンパイルすると、proguardReleaseが失敗しました

Android Studio 1.0.1でassembleReleaseとしてアプリをコンパイルし、次のメッセージを取得しようとしています:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:proguardRelease'.
> Java.io.IOException: Please correct the above warnings first.

アプリはデバッグモードで完全にコンパイルおよび実行され、assembleReleaseはAndroid Studio 0.8。

proguard-rules.proファイルが空です。 build.gradleファイルと完全なエラーを以下に示します。

誰でも助けることができますか?

build.gradle

apply plugin: 'com.Android.application'

Android {
    compileSdkVersion 19
    buildToolsVersion '19.1'

    defaultConfig {
        applicationId "com.xxx.xxx"
        minSdkVersion 15
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-Android.txt'), 'proguard-rules.pro'
        }
    }

    lintOptions {
        abortOnError false
        absolutePaths false
        lintConfig file("lint.xml")
    }
}

repositories {
    mavenCentral()
    flatDir {
        dirs 'aars'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.urbanairship:urbanairship-lib:+@aar'
    compile 'com.google.Android.gms:play-services:6.1.+'
    compile 'me.grantland:autofittextview:0.1.1@aar'
    compile 'com.google.code.gson:gson:2.2.+'
    compile 'net.danlew:Android.joda:2.3.4@aar'
    compile 'com.Android.support:support-v4:21.0.0'
    compile 'com.Android.support:support-v13:21.0.0'
    compile 'com.squareup.okio:okio:1.0.0@jar'
    compile 'net.danlew:Android.joda:2.4.0'
    compile 'de.greenrobot:eventbus:2.2.1'
    compile 'se.emilsjolander:stickylistheaders:2.5.0'
    compile 'se.emilsjolander:StickyScrollViewItems:1.1.0'
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3'
    compile 'com.sothree.slidinguppanel:library:2.0.2'
    compile 'com.squareup.okhttp:okhttp:2.1.0'
    compile 'com.squareup.picasso:picasso:2.4.0'
    compile 'com.squareup.okhttp:okhttp-urlconnection:2.1.0'
    compile 'de.greenrobot:eventbus:2.4.0'
}

エラーは

13:40:19: Executing external task 'assembleRelease'...
:app:preBuild
:app:preReleaseBuild
:app:checkReleaseManifest
:app:preDebugBuild
:app:prepareComAndroidSupportSupportV132100Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42100Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices6171Library UP-TO-DATE
:app:prepareComSothreeSlidinguppanelLibrary202Library UP-TO-DATE
:app:prepareComUrbanairshipUrbanairshipLib510Library UP-TO-DATE
:app:prepareMeGrantlandAutofittextview011Library UP-TO-DATE
:app:prepareNetDanlewAndroidJoda240Library UP-TO-DATE
:app:prepareSeEmilsjolanderStickyScrollViewItems110Library UP-TO-DATE
:app:prepareSeEmilsjolanderStickylistheaders250Library UP-TO-DATE
:app:prepareReleaseDependencies
:app:compileReleaseAidl
:app:compileReleaseRenderscript
:app:generateReleaseBuildConfig
:app:generateReleaseAssets UP-TO-DATE
:app:mergeReleaseAssets
:app:generateReleaseResValues UP-TO-DATE
:app:generateReleaseResources
:app:mergeReleaseResources
:app:processReleaseManifest
:app:processReleaseResources
:app:generateReleaseSources
Note: <path_to_my_project>/app/src/main/Java/com/xxx/xxx/fragments/MatchCenterFragment.Java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
:app:compileReleaseJava
:app:lintVitalRelease
:app:compileReleaseNdk
:app:proguardRelease
Warning: com.ooyala.Android.player.WidevineLibPlayer: can't find superclass or interface com.widevine.drmapi.Android.WVEventListener
( more com.ooyala.* warnings )
Warning: com.squareup.okhttp.internal.huc.HttpsURLConnectionImpl: can't find referenced method 'long getContentLengthLong()' in program class com.squareup.okhttp.internal.huc.HttpURLConnectionImpl
Warning: com.squareup.okhttp.internal.huc.HttpsURLConnectionImpl: can't find referenced method 'long getHeaderFieldLong(Java.lang.String,long)' in program class com.squareup.okhttp.internal.huc.HttpURLConnectionImpl
Warning: com.squareup.okhttp.internal.huc.JavaApiConverter$CacheHttpsURLConnection: can't find referenced method 'long getContentLengthLong()' in program class com.squareup.okhttp.internal.huc.JavaApiConverter$CacheHttpURLConnection
Warning: com.squareup.okhttp.internal.huc.JavaApiConverter$CacheHttpsURLConnection: can't find referenced method 'long getHeaderFieldLong(Java.lang.String,long)' in program class com.squareup.okhttp.internal.huc.JavaApiConverter$CacheHttpURLConnection
Warning: okio.DeflaterSink: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning: okio.Okio: can't find referenced class Java.nio.file.Files
Warning: okio.Okio: can't find referenced class Java.nio.file.Files
Warning: okio.Okio: can't find referenced class Java.nio.file.Files
Warning: okio.Okio: can't find referenced class Java.nio.file.Path
Warning: okio.Okio: can't find referenced class Java.nio.file.OpenOption
Warning: okio.Okio: can't find referenced class Java.nio.file.Path
Warning: okio.Okio: can't find referenced class Java.nio.file.OpenOption
Warning: okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning: okio.Okio: can't find referenced class Java.nio.file.Path
Warning: okio.Okio: can't find referenced class Java.nio.file.OpenOption
Warning: okio.Okio: can't find referenced class Java.nio.file.Path
Warning: okio.Okio: can't find referenced class Java.nio.file.OpenOption
Warning: okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning: there were 234 unresolved references to classes or interfaces.
         You may need to add missing library jars or update their versions.
         If your code works fine without the missing classes, you can suppress
         the warnings with '-dontwarn' options.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Warning: there were 4 unresolved references to program class members.
         Your input classes appear to be inconsistent.
         You may need to recompile the code.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedprogramclassmember)
:app:proguardRelease FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:proguardRelease'.
> Java.io.IOException: Please correct the above warnings first.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 14.674 secs
Please correct the above warnings first.
13:40:35: External task execution finished 'assembleRelease'.
51
jul

これをProGuard設定ファイルに追加します(proguard-rules.proなど)

-dontwarn okio.**
63
hoi

私はプロガードを無効にしなければなりませんでした

minifyEnabled false

最良の解決策ではありませんが、機能します。

18
jul

Gradle 1.1.0でも同じ問題が発生しました。私が移動した古いクラス参照をいくつか覚えていたので、apkをビルドできませんでした。

ビルド> クリーンを試してください。

それは私を助け、そして今、私は再びapkを構築することができます。

7
Vasil Valchev

これをProGuard設定ファイルに追加します(proguard-rules.proなど)

-ignorewarnings 
5
Hojjat Mehri

あなたはすでにあなたの問題を解決していると思います。とにかくこのリンクを参照してください: https://stackoverflow.com/a/29858070/3864698

この修正は、Gradleプラグインバージョン1.4で計画されています。ですから、少し待たなければなりません。

1
DMan