Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/192.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/flash/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 签名后的错误apk_Android_Proguard_Android Contacts_Contactscontract - Fatal编程技术网

Android 签名后的错误apk

Android 签名后的错误apk,android,proguard,android-contacts,contactscontract,Android,Proguard,Android Contacts,Contactscontract,我制作了一个联系人应用程序,使用如下批处理操作 final public class BatchOperation { private final String TAG = "BatchOperation"; private final ContentResolver mResolver; // List for storing the batch mOperations private final ArrayList<ContentProviderOperation> mOpera

我制作了一个联系人应用程序,使用如下批处理操作

final public class BatchOperation {
private final String TAG = "BatchOperation";
private final ContentResolver mResolver;
// List for storing the batch mOperations
private final ArrayList<ContentProviderOperation> mOperations;

public BatchOperation(Context context, ContentResolver resolver) {
    mResolver = resolver;
    mOperations = new ArrayList<ContentProviderOperation>();
}

public int size() {
    return mOperations.size();
}

public void add(ContentProviderOperation cpo) {
    mOperations.add(cpo);
}

public Uri execute() {
    Uri result = null;

    if (mOperations.size() == 0) {
        return result;
    }
    // Apply the mOperations to the content provider
    try {
        ContentProviderResult[] results = mResolver.applyBatch(
                ContactsContract.AUTHORITY, mOperations);
        if ((results != null) && (results.length > 0))
            result = results[0].uri;
    } catch (final OperationApplicationException e1) {
        Log.e(TAG, "storing contact data failed", e1);
    } catch (final RemoteException e2) {
        Log.e(TAG, "storing contact data failed", e2);
    }
    mOperations.clear();
    return result;
}
在这一行

ContentProviderResult[] results = mResolver.applyBatch(ContactsContract.AUTHORITY,
                mOperations);
这是我的proguard文件

-optimizationpasses 5 
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-dontpreverify
-verbose
-dump class_files.txt
-printseeds seeds.txt
-printusage unused.txt
-printmapping mapping.txt
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-allowaccessmodification
-keepattributes *Annotation*
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable
-repackageclasses ''


-dontwarn com.actionbarsherlock.**
-dontwarn org.apache.**
-dontwarn com.commonsware.**
-dontwarn freemarker.**
-dontwarn ezvcard.**

-keep class org.apache.** { *; }
-keep class android.support.v4.app.** { *; } 
-keep class com.actionbarsherlock.** { *; }
-keep class ezvcard.** { *; }
-keep class com.fasterxml.jackson.** { *; }

感谢您的阅读,

当这种情况发生时,我总是向我的开发伙伴提出一个问题。。。你在用Proguard吗? 尝试禁用Proguard并编译到发布模式以进行测试。还可以使用

-dontoptimize
还要检查您的内容提供商是否与以下内容保持一致

-keep public class * extends android.content.ContentProvider

啊,我发现Proguard混淆器
android.content.ContentProviderOperation类。

只需添加此
-保持类android.content.*{*;}
一切正常=)

是的,在禁用proguard后,一切正常,不使用优化选项尝试。我不再使用它了,因为它有点麻烦。我建议您使用sdk附带的默认proguard脚本。这会节省你很多时间。我也遇到同样的问题。我需要从android导入联系人和日历事件。它在调试模式下工作,但在发布模式下应用程序崩溃-dontoptimize-keep public class*扩展了android.content.ContentProvider我在project.properties中添加了这些行,但应用程序仍然崩溃。能与我分享解决方案吗?
-keep public class * extends android.content.ContentProvider