自上週以來,我一直在尋找解決方案。我有一個與Windows Azure服務器連接的應用程序。我需要給我的apk給客戶端,所以我想在部署之前加密我的apk。現在我正在使用proguard,我可以在沒有任何警告的情況下創建apk。但是在安裝之後,設備沒有連接到服務器。沒有proguard它連接。這裏是我的已啓用Android proguard apk未連接到天藍色服務器
我的MainActivity吐司與異常顯示「java.lang.IllegalArgumentException異常:代表移動serviceTable類必須定義一個id屬性」,而分配類
mClient = new MobileServiceClient(
"https://uchek.azure-mobile.net/",
"LslqFcIcUrlbLnYdDxTHUVrZBeQwPX81",
con);
try{
mToDoTable = mClient.getTable(Product.class); //Assigning table
}catch(Exception e){Toast.makeText(getApplicationContext(), e+"",Toast.LENGTH_LONG).show();}
產品的.java
public class ProductInfo {
@com.google.gson.annotations.SerializedName("id")
private int mId;
@com.google.gson.annotations.SerializedName("imei")
private String mIMEI;
public ProductInfo(int id, String imei)
{
this.setId(id);
this.setIMEI(imei);
}
public final void setIMEI(String imei) {
mIMEI = imei;
}
public int getId() {
return mId;
}
public String getIMEI() {
return mIMEI;
}
public final void setId(int id) {
mId = id;
}
}
proguard的-project.txt
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-dontpreverify
-dontshrink
-dontoptimize
-verbose
-injars bin/classes
-injars libs
-outjars bin/classes-processed.jar
-libraryjars libs/achartengine-1.1.0.jar
-libraryjars libs/droidText.0.5.jar
-libraryjars libs/gson-2.2.2.jar
-libraryjars libs/httpclient-4.2.3.jar
-libraryjars libs/joda-time-2.2.jar
-libraryjars libs/mobileservices-0.2.1.jar
-libraryjars libs/mobileservices-0.2.1-javadoc.jar
-libraryjars libs/mobileservices-0.2.1-sources.jar
-dontwarn org.apache.**
-dontwarn org.joda.**
-dontwarn org.slf4j.**
-dontwarn org.json.*
-dontwarn org.mortbay.**
-dontwarn org.apache.log4j.**
-dontwarn org.apache.commons.logging.**
-dontwarn org.apache.commons.logging.**
-dontwarn org.apache.commons.codec.binary.**
-dontwarn javax.xml.**
-dontwarn javax.management.**
-dontwarn java.lang.management.**
-dontwarn android.support.**
-dontwarn com.google.code.**
-dontwarn oauth.signpost.**
-dontwarn twitter4j.**
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-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.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService
-keep public class com.google.code.linkedinapi.**
-keep public class * implements java.io.Serializable
-keep public class * extends android.support.v4.app.Fragment
-keep public class * extends android.support.v4.app.ListFragment
-keep class javax.** { *; }
-keep class org.** { *; }
-keep class twitter4j.** { *; }
-keep class java.lang.management.** { *; }
-keep class com.google.code.** { *; }
-keep class oauth.signpost.** { *; }
-keep class com.microsoft.windowsazure.mobileservices.** { *; }
-keepclassmembers public class com.google.code.linkedinapi.client.impl.LinkedInApiXppClient {
public <init>(java.lang.String, java.lang.String);
}
-keepclasseswithmembernames class * {
native <methods>;
}
-keepclasseswithmembernames class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembernames class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keepclassmembers class * extends com.actionbarsherlock.ActionBarSherlock {
<init>(android.app.Activity, int);
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
-keepclassmembers class fqcn.of.javascript.interface.for.webview {
public *;
}
-keepclassmembers class * implements java.io.Serializable {
static final long serialVersionUID;
private static final java.io.ObjectStreamField[] serialPersistentFields;
private void writeObject(java.io.ObjectOutputStream);
private void readObject(java.io.ObjectInputStream);
java.lang.Object writeReplace();
java.lang.Object readResolve();
}
我試過這個,它沒有工作:/,任何其他建議? – Franco