在android studio中构建apk时找不到Aapt_rules.txt

Cyp*_*ras 16 android proguard gradle android-studio

运行proguard来构建我的apk文件时,我收到以下错误:

Warning:Exception while processing task java.io.FileNotFoundException: C:\Users\Josh\Documents\AdscendUnityPlugin2.1.3\AdscendUnityPlugin2.1.3\HelloUnity\Export\HelloUnity\build\intermediates\proguard-rules\debug\aapt_rules.txt (The system cannot find the path specified)
Run Code Online (Sandbox Code Playgroud)

我的gradle文件:

// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.0'
    }
}

allprojects {
   repositories {
       jcenter()
      flatDir {
        dirs 'libs'
      }
   }
}

apply plugin: 'com.android.application'

repositories {

    maven { url "https://bitbucket.org/adscend/androidsdk/raw/master/" }
}


dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.adscendmedia.sdk:adscendmedia:2.1.26'
}

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.0'

    defaultConfig {
        targetSdkVersion 25
    }

    lintOptions {
        abortOnError false
    }

    buildTypes {
        debug {
            jniDebuggable true
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'
        }
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'

        }
    }

}
Run Code Online (Sandbox Code Playgroud)

我似乎无法找到文件夹'proguard-rules',这可能导致此错误?有任何想法吗?

我知道我在我的调试版本上运行proguard,我只是想让它在这一点上工作.

谢谢

小智 30

在我的情况下,我的自定义proguard.pro是空白的.重建项目适合我.


小智 0

我认为你的 proguard-pro.txt 可能是空白的。我之前也遇到过这样的问题。在 proguard-pro.txt 添加以下代码后,它对我有用。只需尝试一次,它可能对您有用。

# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in D:\Android\adt-bundle-windows-x86-20140702\adt-bundle-windows-x86-20140702\sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}
# Required for GSON
-keep class com.ptechsolutions.android.authenticrecipe.core.** { *; }

-keepattributes *Annotation*
-keepattributes Signature
-keep class sun.misc.Unsafe { *; }

-keep class * extends java.util.ListResourceBundle {
    protected Object[][] getContents();
}

-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
    public static final *** NULL;
}

-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
    @com.google.android.gms.common.annotation.KeepName *;
}

-keepnames class * implements android.os.Parcelable {
    public static final ** CREATOR;
}


-keep class butterknife.** { *; }
-dontwarn butterknife.internal.**
-keep class **$$ViewInjector { *; }

-keepclasseswithmembernames class * {
    @butterknife.* <fields>;
}

-keepclasseswithmembernames class * {
    @butterknife.* <methods>;
}
-dontwarn org.apache.commons.**
-dontwarn com.google.**
-dontwarn com.j256.ormlite**
-dontwarn org.apache.http**

-keepattributes SourceFile,LineNumberTable
-keep class com.j256.**
-keepclassmembers class com.j256.** { *; }
-keep enum com.j256.**
-keepclassmembers enum com.j256.** { *; }
-keep interface com.j256.**
-keepclassmembers interface com.j256.** { *; }

-keepattributes Signature
# GSON Library
# For using GSON @Expose annotation
-keepattributes *Annotation*

# Gson specific classes
-keep class sun.misc.Unsafe { *; }
#-keep class com.google.gson.stream.** { *; }

# Application classes that will be serialized/deserialized over Gson
-keep class com.google.gson.examples.android.model.** { *; }

-keepattributes SourceFile, LineNumberTable

# Google Map
-keep class com.google.android.gms.maps.** { *; }
-keep interface com.google.android.gms.maps.** { *; }

-keep class org.apache.harmony.awt.** { *; }
-dontwarn org.apache.harmony.awt.**

-keep class com.github.siyamed.** { *; }
-dontwarn com.github.siyamed.**

-keep class com.squareup.picasso.** { *; }
-dontwarn com.squareup.picasso.**

-keep class com.squareup.okhttp.** { *; }
-dontwarn com.squareup.okhttp.**

-keep class com.sun.mail.** { *; }
-dontwarn com.sun.mail.**

-keep class org.codehaus.mojo.** { *; }
-dontwarn org.codehaus.mojo.**

-keep class java.awt.datatransfer.** { *; }
-dontwarn java.awt.datatransfer.**

-keep class java.nio.file.** { *; }
-dontwarn java.nio.file.**

-keep class javax.mail.** { *; }
-dontwarn javax.mail.**

-keep class com.theartofdev.edmodo.** { *; }
-dontwarn com.theartofdev.edmodo.**

-keep class javax.activation.** { *; }
-dontwarn javax.activation.**

-dontskipnonpubliclibraryclassmembers
Run Code Online (Sandbox Code Playgroud)