在Android SDK管理器中进行一些更新之后,我尝试使用签名的apk来获取:
ProGuard: [] Warning: com.google.android.gms.auth.GoogleAuthUtil:
can't find referenced class com.google.android.gms.R
ProGuard: [] Warning: com.google.android.gms.auth.GoogleAuthUtil:
can't find referenced class com.google.android.gms.R$string
...
etc.
Run Code Online (Sandbox Code Playgroud)
如果设置-dontwarn com.google.android.gms.**编译没问题.但是在运行之后,我得到许多类似的报告错误(来自许多设备):
Caused by: android.view.InflateException: Binary XML file line #32:
Error inflating class com.google.android.gms.common.SignInButton
Run Code Online (Sandbox Code Playgroud)
在我的设备上一切都好.在更新之前,我没有ProGuard警告,所有工作都完美无缺.怎么修理?
正在寻找Guava的ProGuard配置,它将进行模糊处理和优化,因为网站上提供的默认配置不会.
不仅我不能让它导出我的apk,我一直得到:
Warning: com.google.common.collect.MinMaxPriorityQueue:
can't find referenced field 'int UNSET_EXPECTED_SIZE' in class
com.google.common.collect.MinMaxPriorityQueue$Builder
You should check if you need to specify additional program jars.
Run Code Online (Sandbox Code Playgroud) 我正在使用android studio来构建调试和发布应用程序.当我构建调试/发布应用程序时
./gradlew assembleDebug
./gradlew assembleRelease
Run Code Online (Sandbox Code Playgroud)
这两个版本都是完美创建并运行的.显示调试或发布的相应对话框
现在我在build.gradle中添加了proguard详细信息:
signingConfigs {
myConfig {
storeFile file("keystore.jks")
storePassword "abc123!"
keyAlias "androidreleasekey"
keyPassword "pqrs123!"
}
}
buildTypes {
release {
runProguard true
proguardFile getDefaultProguardFile('proguard-android-optimize.txt')
signingConfig signingConfigs.myConfig
}
}
productFlavors {
defaultFlavor {
proguardFile 'proguard-rules.txt'
}
}
Run Code Online (Sandbox Code Playgroud)
现在它在事件日志中显示错误为
警告:有7个未解析的类或接口引用.您可能需要添加缺少的库jar或更新其版本.如果您的代码在没有缺少类的情况下正常工作,则可以使用"-dontwarn"选项来禁止警告.(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
警告:程序类成员有2个未解析的引用.您的输入类似乎不一致.您可能需要重新编译代码.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedprogramclassmember):Flash销售:proguardDefaultFlavorRelease FAILED
如果我将runProguard选项设置为false然后运行它.
我有这些问题:
1)用runProguard = false发布apk是否可以?
2)如何在创建发布版本时使用dontwarn?
我在我的android项目中使用simplexml,一切正常,直到我混淆代码.然后,错误开始涌入.
部分XML如下:
<categories success="true">
<category id="102" caption="Magazin" parent="0" num_mags="114" >
<category id="15" caption="Kunst" parent="102" num_mags="13" >
<category id="17" caption="Design" parent="15" num_mags="10" ></category>
<category id="18" caption="Haute+Couture" parent="15" num_mags="2" >
...
Run Code Online (Sandbox Code Playgroud)
我有两个类:CategoryItemList:
@Root(name = "categories")
public class CategoryItemList {
private final List<CategoryItem> mCategoryItems;
/**
* Create a new category items list.
*
* @param categoryItems the list of category items
*/
public CategoryItemList(@ElementList(name = "category", inline = true) final List<CategoryItem> categoryItems) {
mCategoryItems = categoryItems;
}
@ElementList(name = "category", inline = true) …Run Code Online (Sandbox Code Playgroud) 自从我将ADT从16更新到18(将Proguard的更新从4.6更新到4.8)后,Proguard的表现非常奇怪(并且不一致?).
最新的问题是当我尝试导出签名(发布)APK时,我收到以下错误:
Proguard returned with error code 1. See console
Warning: com.bta.LibProj2: can't find referenced class com.bta.R$string
Warning: com.bta.MyDlg1: can't find referenced class com.bta.R$string
Warning: com.bta.MyMenu: can't find referenced class com.bta.R$menu
Warning: com.bta.R: can't find referenced class com.bta.R$attr
Warning: com.bta.R: can't find referenced class com.bta.R$drawable
Warning: com.bta.R: can't find referenced class com.bta.R$menu
Warning: com.bta.R: can't find referenced class com.bta.R$string
Warning: com.bta.myapp.MyAppActivity$1: can't find referenced class com.bta.myapp.MyAppActivity
Warning: com.bta.myapp.MyAppActivity$ELicenseResponse: can't find referenced class com.bta.myapp.MyAppActivity
Warning: com.bta.myapp.MyAppActivity$MyLicenseCheckerCallback$1: can't find referenced class com.bta.myapp.MyAppActivity$MyLicenseCheckerCallback …Run Code Online (Sandbox Code Playgroud) 有几个问题,但没有解决方案适合我.我认为这很容易使用.我刚拿到一个控制台can't find referenced class
这是我的proguard-project.txt
-injars bin/classes
-injars libs
-outjars bin/classes-processed.jar
-libraryjars C:/Users/ME/android-sdks/platforms/android-10/android.jar
-dontpreverify
-repackageclasses ''
-allowaccessmodification
-optimizations !code/simplification/arithmetic
-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.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);
} …Run Code Online (Sandbox Code Playgroud) 我刚刚将Android SDK,ADT和Proguard升级到最新版本.
我的项目编译构建并在调试模式下运行良好,但是一旦我尝试导出它的签名版本APK,我就会从Eclipse控制台上的导出向导收到错误而没有任何错误日志消息!*

如果我尝试通过Window->Show View->Error Log所有查看错误日志,我看到更多相同:

我不知道该怎么办,因为Eclipse和Proguard都不会暗示问题是什么.
我的项目在最近的升级之前一直很好.没有构建警告.没有棉绒警告!
我正在使用Android的标准配置文件${sdk.dir}\tools\proguard\proguard-android.txt:
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-verbose
-dontoptimize
-dontpreverify
-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.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class * extends android.support.v4.app.Fragment
-keep …Run Code Online (Sandbox Code Playgroud) onDelete在Kotlin类中有一个方法.
override fun onDelete(position: Int) {
templates?.apply {
val deleteDialog = DeleteTemplateDialog(view.getViewContext())
deleteDialog.confirmListener = {
CustomTemplateRepository.getInstance().deleTemplate(this[position].templateId!!)
.subscribe({
deleteDialog.dismiss()
this.removeAt(position)
customTemplateAdapter?.notifyDataSetChanged()
view.showEmptyView(this.isEmpty())
}, {})
}
}
}
Run Code Online (Sandbox Code Playgroud)
当我构建release-apk时,我启用proguard但由于以下警告而失败.
警告:com.uniquestudio.android.iemoji.module.library.customtemplate.MyTemplatePresenter $ onDelete $ 1 $ 1 $ 2:找不到引用的类com.uniquestudio.android.iemoji.module.library.customtemplate.MyTemplatePresenter $ onDelete $ 1 $ 1
当我使用dex2jar从debug-APK检索此类时.我懂了.
public void onDelete(final int paramInt)
{
final DeleteTemplateDialog localDeleteTemplateDialog = new DeleteTemplateDialog(this.view.getViewContext());
localDeleteTemplateDialog.setConfirmListenner((Function0)new Lambda(localArrayList)
{
public final Disposable invoke()
{
CustomTemplateRepository localCustomTemplateRepository = CustomTemplateRepository.Companion.getInstance();
String str = ((Template)this.receiver$0.get(paramInt)).getTemplateId();
if (str == null) {
Intrinsics.throwNpe(); …Run Code Online (Sandbox Code Playgroud) 我主要出于混淆的原因使用Proguard。
我在Android中使用proguard时遇到问题。我使用了simpleframework来解析XML。它的外部。
在proguard cfg中:
-keepattributes *Annotation*,EnclosingMethod
-keep public class org.simpleframework.**{ *; }
-keep public class org.simpleframework.xml.**{ *; }
-keep public class org.simpleframework.xml.core.**{ *; }
-keep public class org.simpleframework.xml.util.**{ *; }
-keep public class org.simpleframework.xml.stream.**{ *; }
-keep public class javax.** { *; }
-keep public class javax.xml.stream.**{ *; }
-keep public class org.simpleframework.** {
public void set*(***);
public *** get*();
}
Run Code Online (Sandbox Code Playgroud)
错误:
Warning: org.simpleframework.xml.stream.StreamProvider: can't find referenced class javax.xml.stream.XMLInputFactory
Warning: org.simpleframework.xml.stream.StreamProvider: can't find referenced class javax.xml.stream.XMLInputFactory
Warning: org.simpleframework.xml.stream.StreamProvider: can't find …Run Code Online (Sandbox Code Playgroud) 在Android中,我有以下设置的proguard.
-dontpreverify
# Hold onto the mapping.text file, it can be used to unobfuscate stack traces in the developer console using the retrace tool
-printmapping mapping.txt
# Keep line numbers so they appear in the stack trace of the develeper console
-keepattributes SourceFile,LineNumberTable
# The -optimizations option disables some arithmetic simplifications that Dalvik 1.0 and 1.5 can't handle.
-optimizations !code/simplification/arithmetic
# Activities, services and broadcast receivers are specified in the manifest file so they won't be automatically included
-keep public …Run Code Online (Sandbox Code Playgroud) 在生成签名的APK时,我得到了这些警告
Warning: org.junit.internal.runners.statements.FailOnTimeout: can't find referenced class java.lang.management.ManagementFactory
Warning: org.junit.internal.runners.statements.FailOnTimeout: can't find referenced class java.lang.management.ThreadMXBean
Warning: org.junit.internal.runners.statements.FailOnTimeout: can't find referenced class java.lang.management.ThreadMXBean
Warning: org.junit.internal.runners.statements.FailOnTimeout: can't find referenced class java.lang.management.ManagementFactory
Warning: org.junit.internal.runners.statements.FailOnTimeout: can't find referenced class java.lang.management.ThreadMXBean
Warning: org.junit.internal.runners.statements.FailOnTimeout: can't find referenced class java.lang.management.ThreadMXBean
Warning: org.junit.rules.DisableOnDebug: can't find referenced class java.lang.management.ManagementFactory
Warning: org.junit.rules.DisableOnDebug: can't find referenced class java.lang.management.RuntimeMXBean
Warning: org.junit.rules.DisableOnDebug: can't find referenced class java.lang.management.ManagementFactory
Warning: org.junit.rules.DisableOnDebug: can't find referenced class java.lang.management.RuntimeMXBean
Run Code Online (Sandbox Code Playgroud)
我应该怎么做才能避免这些警告?在此先感谢您的帮助。