2017-05-30 13 views
9

में रिलीज बिल्ड बनाने में असमर्थ, मेरी एंड्रॉइड प्रोजेक्ट को कोटलिन में परिवर्तित करने के बाद मैं रिलीज बिल्ड बनाने में असमर्थ हूं, त्रुटि प्रोगुर्ड से संबंधित प्रतीत होती है।कोटलिन

मैं 155 चेतावनी

Warning:com.example.app.activity.MainActivity$1: can't find referenced field 'android.view.View decorView' in program class com.example.app.activity.MainActivity 
Warning:com.example.app.activity.MainActivity$2: can't find referenced field 'android.os.Handler handler' in program class com.example.app.activity.MainActivity 

की तरह देखते हैं और अगर मैं गलत निर्माण सफल होता है के लिए सही से build.grade में इन निर्देशों को बदलने का निर्माण

Error:Execution failed for task ':MyApp:transformClassesAndResourcesWithProguardForFreeRelease'. 
> Job failed, see logs for details 

साथ विफल रहता है।

minifyEnabled true 
shrinkResources true 

समस्या के बारे में कोई सुझाव क्या हो सकता है?

संपादित करें:

ProGuard फ़ाइलों में नीचे हैं:

ProGuard-android.txt

# This is a configuration file for ProGuard. 
# http://proguard.sourceforge.net/index.html#manual/usage.html 

-dontusemixedcaseclassnames 
-dontskipnonpubliclibraryclasses 
-verbose 

# Optimization is turned off by default. Dex does not like code run 
# through the ProGuard optimize and preverify steps (and performs some 
# of these optimizations on its own). 
-dontoptimize 
-dontpreverify 

# If you want to enable optimization, you should include the 
# following: 
# -optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/* 
# -optimizationpasses 5 
# -allowaccessmodification 
# 
# Note that you cannot just include these flags in your own 
# configuration file; if you are including this file, optimization 
# will be turned off. You'll need to either edit this file, or 
# duplicate the contents of this file and remove the include of this 
# file from your project's proguard.config path property. 

-keepattributes *Annotation* 
-keep public class * extends android.app.Activity 
-keep public class * extends android.app.Application 
-keep public class * extends android.app.Service 
-keep public class * extends android.content.BroadcastReceiver 
-keep public class * extends android.content.ContentProvider 
-keep public class * extends android.app.backup.BackupAgent 
-keep public class * extends android.preference.Preference 
-keep public class * extends android.support.v4.app.Fragment 
-keep public class * extends android.app.Fragment 
-keep public class com.android.vending.licensing.ILicensingService 


# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native 
-keepclasseswithmembernames class * { 
    native <methods>; 
} 

-keep public class * extends android.view.View { 
    public <init>(android.content.Context); 
    public <init>(android.content.Context, android.util.AttributeSet); 
    public <init>(android.content.Context, android.util.AttributeSet, int); 
    public void set*(...); 
} 

-keepclasseswithmembers class * { 
    public <init>(android.content.Context, android.util.AttributeSet); 
} 

-keepclasseswithmembers class * { 
    public <init>(android.content.Context, android.util.AttributeSet, int); 
} 

-keepclassmembers class * extends android.app.Activity { 
    public void *(android.view.View); 
} 

# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations 
-keepclassmembers enum * { 
    public static **[] values(); 
    public static ** valueOf(java.lang.String); 
} 

-keep class * implements android.os.Parcelable { 
    public static final android.os.Parcelable$Creator *; 
} 

-keepclassmembers class **.R$* { 
    public static <fields>; 
} 

# The support library contains references to newer platform versions. 
# Don't warn about those in case this app is linking against an older 
# platform version. We know about them, and they are safe. 
-dontwarn android.support.** 
-dontwarn io.codetail.animation.** 

ProGuard-rules.txt

# Add project specific ProGuard rules here. 
# By default, the flags in this file are appended to flags specified 
# in /home/francesc/droids/android-sdk-linux/tools/proguard/proguard-android.txt 
# You can edit the include path and order by changing the ProGuard 
# include property in project.properties. 
# 
# 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 *; 
#} 

-keep class com.nineoldandroids.** { *; } 
-dontwarn io.codetail.animation.** 

हस्ताक्षर करने config के रूप में परिभाषित किया गया है नीचे दिखाया गया है

signingConfigs { 
    myConfig { 
     Properties keyProps = new Properties() 
     keyProps.load(new FileInputStream(file('../release.properties'))) 
     storeFile file(keyProps["store"]) 
     keyAlias keyProps["alias"] 
     storePassword keyProps["storePass"] 
     keyPassword keyProps["keyPass"] 
    } 
} 

buildTypes { 
    release { 
     proguardFiles 'proguard-android.txt', 'proguard-rules.txt' 
     minifyEnabled true 
     shrinkResources true 
     signingConfig signingConfigs.myConfig 
    } 
} 
+0

उपयोगी हो सकता है https://stackoverflow.com/questions/33547643/how-to-use-kotlin-with-proguard/34159813#34159813 – Redman

+0

क्या आपकी गतिविधि में कोई कस्टम दृश्य है? –

+0

शायद, आप shrink स्रोतों को "सत्य" में छोड़ सकते हैं क्योंकि यह केवल संसाधनों को प्रभावित करता है, लेकिन कोड – cyanide

उत्तर

0

बिना किसी समस्या के निर्माण के प्रयास को अनावश्यक करने के लिए प्रयास करें जो उस मुद्दे के लिए ज़िम्मेदार है।