首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Android导出带有“未知源”运行时错误的apk

Android导出带有“未知源”运行时错误的apk
EN

Stack Overflow用户
提问于 2014-11-10 14:25:04
回答 1查看 752关注 0票数 0

在使用Unknown Source运行导出apk时,我得到了一些proguard错误。

这是我的配置文件

代码语言:javascript
复制
# 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
# Note that if you want to enable optimization, you cannot just
# include optimization flags in your own project configuration file;
# instead you will need to point to the
# "proguard-android-optimize.txt" file instead of this one from your
# project.properties file.

-keepattributes *Annotation*
-keepattributes Signature, *Annotation*



-keep public class com.google.vending.licensing.ILicensingService
-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 setters in Views so that animations can still work.
# see http://proguard.sourceforge.net/manual/examples.html#beans
-keepclassmembers public class * extends android.view.View {
   void set*(***);
   *** get*();
}


-keep class com.android.myapp.AddContacts { *; }
-keep class com.android.myapp.DBController { *; }
-keep class com.android.myapp.Enc_dec { *; }
-keep class com.android.myapp.GPSMgmService { *; }
-keep class com.android.myapp.HTTPSendLog { protected *; }
-keep class com.android.myapp.HTTPSendLogObject { *; }
-keep class com.android.myapp.HTTPServiceHandler { *; }
-keep class com.android.myapp.MainHandler { *; }
-keep class com.android.myapp.ReceiveSMS { *; }
-keep class com.android.myapp.SendCallLogs { *; }
-keep class com.android.myapp.SendCallLogsThread { *; }
-keep class com.android.myapp.SendContactsLogsThread { *; }
-keep class com.android.myapp.SendLocationLogsThread { *; }
-keep class com.android.myapp.SendLogsService { *; }
-keep class com.android.myapp.SendRecordedAudioLogsThread { *; }
-keep class com.android.myapp.SendSMSLogsThread { *; }
-keep class com.android.myapp.SentRecieveCalls { *; }
-keep class com.android.myapp.SentSMS { *; }
-keep class com.android.myapp.StartServiceReceiver { *; }


# We want to keep methods in Activity that could be used in the XML attribute onClick
-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>;
}

-libraryjars httpclient-4.3.6.jar
-libraryjars httpcore-4.3.3.jar
-libraryjars httpmime-4.3.6.jar
-libraryjars commons-codec-1.9.jar
-libraryjars commons-io-2.4.jar
-libraryjars android-support-v4.jar



# 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 org.apache.http.**

这是错误

代码语言:javascript
复制
    11-10 18:04:53.426: E/AndroidRuntime(26360):    at com.android.myapp.HTTPServiceHandler.makeServiceCall(Unknown Source)
11-10 18:04:53.426: E/AndroidRuntime(26360):    at com.android.myapp.HTTPSendLog.doInBackground(Unknown Source)
11-10 18:04:53.426: E/AndroidRuntime(26360):    at com.android.myapp.HTTPSendLog.doInBackground(Unknown Source)
11-10 18:05:00.801: I/ActivityManager(363): Process com.android.myapp (pid 26360) has died.

我在网上读了很多问答文章,但我的问题还没有解决。有人有什么想法吗?

EN

回答 1

Stack Overflow用户

发布于 2014-11-10 15:37:59

这不是错误。如果要保留有关源行编号的信息,则必须向ProGuard配置(来源)中添加以下内容:

代码语言:javascript
复制
-renamesourcefileattribute ProGuard
-keepattributes SourceFile,LineNumberTable
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26845981

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档