Can not export signed APK with ProGuard enable when using MoPub integration with the following warning:
Proguard returned with error code 1. See console
Warning: com.mopub.nativeads.MoPubRecyclerAdapter: can't find referenced method 'void notifyItemInserted(int)' in class com.mopub.nativeads.MoPubRecyclerAdapter
Warning: com.mopub.nativeads.MoPubRecyclerAdapter: can't find referenced method 'void notifyItemRemoved(int)' in class com.mopub.nativeads.MoPubRecyclerAdapter
Warning: com.mopub.nativeads.MoPubRecyclerAdapter$3: can't find referenced method 'void notifyDataSetChanged()' in class com.mopub.nativeads.MoPubRecyclerAdapter
Warning: com.mopub.nativeads.MoPubRecyclerAdapter$3: can't find referenced method 'void notifyItemRangeChanged(int,int)' in class com.mopub.nativeads.MoPubRecyclerAdapter
Warning: com.mopub.nativeads.MoPubRecyclerAdapter$3: can't find referenced method 'void notifyItemRangeInserted(int,int)' in class com.mopub.nativeads.MoPubRecyclerAdapter
Warning: com.mopub.nativeads.MoPubRecyclerAdapter$3: can't find referenced method 'void notifyItemRangeRemoved(int,int)' in class com.mopub.nativeads.MoPubRecyclerAdapter
You should check if you need to specify additional program jars.
Your input classes appear to be inconsistent.
Related
I have these warnings? How to solve it?
I tried to do -dontwarn kotlinx.coroutines.flow.**inlined**
It solves the warning, but I think my app crashes.
Warning: kotlinx.coroutines.flow.FlowKt__BuildersKt$asFlow$$inlined$unsafeFlow$10$1: can't find enclosing method 'java.lang.Object collect$$forInline(kotlinx.coroutines.flow.FlowCollector,kotlin.coroutines.Continuation)' in program class kotlinx.coroutines.flow.FlowKt__BuildersKt$asFlow$$inlined$unsafeFlow$10
Warning: kotlinx.coroutines.flow.FlowKt__BuildersKt$asFlow$$inlined$unsafeFlow$2$1: can't find enclosing method 'java.lang.Object collect$$forInline(kotlinx.coroutines.flow.FlowCollector,kotlin.coroutines.Continuation)' in program class kotlinx.coroutines.flow.FlowKt__BuildersKt$asFlow$$inlined$unsafeFlow$2
Warning: kotlinx.coroutines.flow.FlowKt__BuildersKt$asFlow$$inlined$unsafeFlow$3$1: can't find enclosing method 'java.lang.Object collect$$forInline(kotlinx.coroutines.flow.FlowCollector,kotlin.coroutines.Continuation)' in program class kotlinx.coroutines.flow.FlowKt__BuildersKt$asFlow$$inlined$unsafeFlow$3
Warning: kotlinx.coroutines.flow.FlowKt__BuildersKt$asFlow$$inlined$unsafeFlow$4$1: can't find enclosing method 'java.lang.Object collect$$forInline(kotlinx.coroutines.flow.FlowCollector,kotlin.coroutines.Continuation)' in program class kotlinx.coroutines.flow.FlowKt__BuildersKt$asFlow$$inlined$unsafeFlow$4
Warning: kotlinx.coroutines.flow.FlowKt__BuildersKt$asFlow$$inlined$unsafeFlow$5$1: can't find enclosing method 'java.lang.Object collect$$forInline(kotlinx.coroutines.flow.FlowCollector,kotlin.coroutines.Continuation)' in program class kotlinx.coroutines.flow.FlowKt__BuildersKt$asFlow$$inlined$unsafeFlow$5
Warning: kotlinx.coroutines.flow.FlowKt__BuildersKt$asFlow$$inlined$unsafeFlow$6$1: can't find enclosing method 'java.lang.Object collect$$forInline(kotlinx.coroutines.flow.FlowCollector,kotlin.coroutines.Continuation)' in program class kotlinx.coroutines.flow.FlowKt__BuildersKt$asFlow$$inlined$unsafeFlow$6
Warning: kotlinx.coroutines.flow.FlowKt__BuildersKt$asFlow$$inlined$unsafeFlow$7$1: can't find enclosing method 'java.lang.Object collect$$forInline(kotlinx.coroutines.flow.FlowCollector,kotlin.coroutines.Continuation)' in program class kotlinx.coroutines.flow.FlowKt__BuildersKt$asFlow$$inlined$unsafeFlow$7
-dontwarn does what it says. This might rather be something alike:
-keep class kotlinx.coroutines.**
I updated from kotlinx-coroutines-android:1.3.2 to :1.3.7, at which point all of those warnings went away.
I did get a few new ones, and needed to add the following to remove them:
-dontwarn kotlinx.coroutines.debug.**
I've a build error when I set the certificate fields, also reading the Error Log I can't find the point, what I'm missing.
With blank certificate fields everything works fine and I get my apk.
Here my builds params
ios.locationUsageDescription=Some functionality of the application depends on your location
ios.objC=true
ios.project_type=ios
win.ver=8
android.xpermissions=<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/><uses-feature android:glEsVersion="0x00020000" android:required="true"/>
ios.dsym=false
android.xapplication=<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="XXXXXXXXXXXXXXXXXXXXX"/>
ios.glAppDelegateHeader=
#import "GoogleMaps/GoogleMaps.h"
ios.add_libs=SystemConfiguration.framework
ios.statusbar_hidden=false
ios.application_exits=false
ios.includePush=false
android.playService.maps=true
android.GoogleMaps.minPlayServicesVersion=9.4.0
j2me.nativeThemeConst=0
java.version=8
ios.pods=,GoogleMaps
ios.prerendered_icon=false
ios.testFlight=false
rim.obfuscation=false
ios.interface_orientation=UIInterfaceOrientationPortrait:UIInterfaceOrientationPortraitUpsideDown:UIInterfaceOrientationLandscapeLeft:UIInterfaceOrientationLandscapeRight
ios.newStorageLocation=true
android.release=true
ios.pods.platform=,7.0
android.debug=true
ios.pods.sources=,https://github.com/CocoaPods/Specs.git
Can you give me a hint or some link to read?
Thank's, Davide.
Your build failed because of below proguard warnings :
Warning: net.amicofree.fdrmobile.cno.forms.BarCodeForm: can't find referenced class org.apache.avalon.framework.configuration.DefaultConfiguration
Warning: net.amicofree.fdrmobile.cno.forms.BarCodeForm: can't find referenced class org.apache.avalon.framework.configuration.DefaultConfiguration
Warning: net.amicofree.fdrmobile.cno.forms.BarCodeForm: can't find referenced class org.apache.avalon.framework.configuration.DefaultConfiguration
Warning: net.amicofree.fdrmobile.cno.forms.BarCodeForm: can't find referenced class org.apache.avalon.framework.configuration.DefaultConfiguration
Warning: net.amicofree.fdrmobile.cno.forms.BarCodeForm: can't find referenced class org.apache.avalon.framework.configuration.DefaultConfiguration
Warning: net.amicofree.fdrmobile.cno.forms.BarCodeForm: can't find referenced class org.apache.avalon.framework.configuration.DefaultConfiguration
Warning: net.amicofree.fdrmobile.cno.forms.BarCodeForm: can't find referenced class org.apache.avalon.framework.configuration.DefaultConfiguration
Warning: net.amicofree.fdrmobile.cno.forms.BarCodeForm: can't find referenced class org.apache.avalon.framework.configuration.DefaultConfiguration
Warning: net.amicofree.fdrmobile.cno.forms.BarCodeForm: can't find referenced class org.apache.avalon.framework.configuration.DefaultConfiguration
If you think that the referenced class exist in your compiled and build project, you can add below line to your proguard rules to supress these warnings:
-dontwarn net.amicofree.fdrmobile.cno. forms.**
When building apk using Proguard, I see theses Warnings:
com.google.android.gms.internal.zzaq: can't find referenced class com.google.android.gms.internal.zzzk
com.google.android.gms.internal.zzaq: can't find referenced class com.google.android.gms.internal.zzzk$zza
com.google.android.gms.internal.zzaq: can't find referenced class com.google.android.gms.internal.zzzk
com.google.android.gms.internal.zzaq: can't find referenced class com.google.android.gms.internal.zzzk$zza
com.google.android.gms.internal.zzaq: can't find referenced class com.google.android.gms.internal.zzzk$zza
com.google.android.gms.internal.zzaq: can't find referenced class com.google.android.gms.internal.zzzk$zza
com.google.android.gms.internal.zzaq: can't find referenced class com.google.android.gms.internal.zzzk
com.google.android.gms.internal.zzaq$1: can't find referenced class com.google.android.gms.internal.zzzk
com.google.android.gms.internal.zzaq$1: can't find referenced class com.google.android.gms.internal.zzzk
com.google.android.gms.internal.zzbd: can't find referenced class com.google.android.gms.internal.zzaqg
com.google.android.gms.internal.zzbd: can't find referenced class com.google.android.gms.internal.zzzk
com.google.android.gms.internal.zzbd: can't find referenced class com.google.android.gms.internal.zzzk
com.google.android.gms.internal.zzbd: can't find referenced class com.google.android.gms.internal.zzaqg
com.google.android.gms.internal.zzej: can't find referenced field 'int[] AdsAttrs' in program class com.google.android.gms.R$styleable
com.google.android.gms.internal.zzej: can't find referenced field 'int AdsAttrs_adSize' in program class com.google.android.gms.R$styleable
com.google.android.gms.internal.zzej: can't find referenced field 'int AdsAttrs_adSizes' in program class com.google.android.gms.R$styleable
com.google.android.gms.internal.zzej: can't find referenced field 'int AdsAttrs_adUnitId' in program class com.google.android.gms.R$styleable
I'm using Google Play Services 10.2.0, modules ads, ads-lite, analytics, analytics-impl, base, basement, drive, games, tasks.
What modules or libraries need to be included to fix those warnings?
Based from this thread, if you use ProGuard, you need to keep some GMS (Google Play Services) classes and they are annotated with #com.google.android.gms.common.annotation.KeepName.
You need to ignore like you are compiling but you also need to keep the class so it can find it during runtime.
Add these two lines to your proguard configuration file:
-keep class com.google.android.gms.** { *; }
-dontwarn com.google.android.gms.**
You may also check these related SO posts:
Proguard and error
com.google.android.gms.internal.zzhu: can't find referenced class android.security.NetworkSecurityPolicy
How to use -dontwarn in ProGuard?
I am having a strange problem with proguard and kotlin. I am gradually converting a proguarded project to kotlin - which went very fine so far but I am getting proguard errors when converting certain classes. I could not yet isolate what the special property of these classes is so it breaks - they seems to be no different than the other ones. As an example InputStreamWithSource is just:
package org.ligi.passandroid.model
import java.io.InputStream
class InputStreamWithSource(val source: String, val inputStream: InputStream)
and it completely works in the IDE - I can deploy to a device - also all UI tests are running fine. Just when trying to assembleRelease the project I am getting proguard errors I do not understand:
Warning: org.ligi.passandroid.ui.FileUnzipControllerSpec: can't find referenced class org.ligi.passandroid.model.InputStreamWithSource
Warning: org.ligi.passandroid.ui.FileUnzipControllerSpec: can't find referenced class org.ligi.passandroid.model.InputStreamWithSource
Warning: org.ligi.passandroid.ui.InputStreamProvider: can't find referenced class org.ligi.passandroid.model.InputStreamWithSource
Warning: org.ligi.passandroid.ui.InputStreamProvider: can't find referenced class org.ligi.passandroid.model.InputStreamWithSource
Warning: org.ligi.passandroid.ui.InputStreamProvider: can't find referenced class org.ligi.passandroid.model.InputStreamWithSource
Warning: org.ligi.passandroid.ui.InputStreamProvider: can't find referenced class org.ligi.passandroid.model.InputStreamWithSource
Warning: org.ligi.passandroid.ui.InputStreamProvider: can't find referenced class org.ligi.passandroid.model.InputStreamWithSource
Warning: org.ligi.passandroid.ui.InputStreamProvider: can't find referenced class org.ligi.passandroid.model.InputStreamWithSource
Warning: org.ligi.passandroid.ui.PassImportActivity$ImportAndShowAsyncTask: can't find referenced class org.ligi.passandroid.model.InputStreamWithSource
Warning: org.ligi.passandroid.ui.PassImportActivity$ImportAndShowAsyncTask: can't find referenced class org.ligi.passandroid.model.InputStreamWithSource
Warning: org.ligi.passandroid.ui.PassImportActivity$ImportAndShowAsyncTask: can't find referenced class org.ligi.passandroid.model.InputStreamWithSource
Warning: org.ligi.passandroid.ui.PassImportActivity$ImportAndShowAsyncTask: can't find referenced class org.ligi.passandroid.model.InputStreamWithSource
Warning: org.ligi.passandroid.ui.PassImportActivity$ImportAndShowAsyncTask: can't find referenced class org.ligi.passandroid.model.InputStreamWithSource
Warning: org.ligi.passandroid.ui.PassViewActivityBase$UpdateAsync: can't find referenced class org.ligi.passandroid.model.InputStreamWithSource
Warning: org.ligi.passandroid.ui.PassViewActivityBase$UpdateAsync: can't find referenced class org.ligi.passandroid.model.InputStreamWithSource
Warning: org.ligi.passandroid.ui.PassViewActivityBase$UpdateAsync: can't find referenced class org.ligi.passandroid.model.InputStreamWithSource
Warning: org.ligi.passandroid.ui.SearchPassesIntentService: can't find referenced class org.ligi.passandroid.model.InputStreamWithSource
Warning: org.ligi.passandroid.ui.UnzipPassController: can't find referenced class org.ligi.passandroid.model.InputStreamWithSource
Warning: org.ligi.passandroid.ui.UnzipPassController: can't find referenced class org.ligi.passandroid.model.InputStreamWithSource
Warning: org.ligi.passandroid.ui.UnzipPassController$InputStreamUnzipControllerSpec: can't find referenced class org.ligi.passandroid.model.InputStreamWithSource
Warning: org.ligi.passandroid.ui.UnzipPassController$InputStreamUnzipControllerSpec: can't find referenced class org.ligi.passandroid.model.InputStreamWithSource
Warning: org.ligi.passandroid.ui.UnzipPassController$InputStreamUnzipControllerSpec: can't find referenced class org.ligi.passandroid.model.InputStreamWithSource
Warning: org.ligi.passandroid.ui.UnzipPassController$InputStreamUnzipControllerSpec: can't find referenced class org.ligi.passandroid.model.InputStreamWithSource
Warning: org.ligi.passandroid.ui.UnzipPassDialog: can't find referenced class org.ligi.passandroid.model.InputStreamWithSource
Warning: org.ligi.passandroid.ui.UnzipPassDialog: can't find referenced class org.ligi.passandroid.model.InputStreamWithSource
Warning: org.ligi.passandroid.ui.UnzipPassDialog$1AlertDialogUpdater: can't find referenced class org.ligi.passandroid.model.InputStreamWithSource
Warning: org.ligi.passandroid.ui.UnzipPassDialog$1AlertDialogUpdater: can't find referenced class org.ligi.passandroid.model.InputStreamWithSource
when I add a dontwarn for these classes in the proguard configuration than it crashes at runtime - so these classes are really removed - but they should not be removed as they are used.
I can work around this problem by adding keep class/enum for these classes in the proguard-config - but the question is why this is needed for these classes - IMHO it should not be needed
Anyone has some Idea what could cause this or how best to investigate this problem? The full source is here: https://github.com/ligi/PassAndroid
I would make sure that I have my own package defined in proguard - something like this:
-dontwarn org.ligi.passandroid.**
-keep class org.ligi.passandroid.** { *; }
I'm trying to use Proguard to obfuscate my code. I use Mobclix for advertisements, and when I build my APK it's spitting out an error:
org.eclipse.core.runtime.CoreException: Proguard returned with error code 1. See console
at com.android.ide.eclipse.adt.internal.project.ExportHelper.exportReleaseApk(ExportHelper.java:228)
at com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard.doExport(ExportWizard.java:290)
at com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard.access$0(ExportWizard.java:229)
at com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard$1.run(ExportWizard.java:214)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Caused by: Proguard Error 1
Output:
Warning: com.mobclix.android.sdk.MobclixContactsCursorEntityIterator: can't find referenced class android.content.Entity
Warning: com.mobclix.android.sdk.MobclixContactsCursorEntityIterator: can't find referenced class android.content.Entity
Warning: com.mobclix.android.sdk.MobclixContactsSdk5$EntityIteratorImpl: can't find referenced class android.content.Entity
Warning: com.mobclix.android.sdk.MobclixContactsSdk5$EntityIteratorImpl: can't find referenced class android.content.Entity
Warning: com.mobclix.android.sdk.MobclixContactsSdk5$EntityIteratorImpl: can't find referenced class android.content.Entity
Warning: com.mobclix.android.sdk.MobclixContactsSdk5$EntityIteratorImpl: can't find referenced class android.content.Entity
Warning: com.mobclix.android.sdk.MobclixContactsSdk5$EntityIteratorImpl: can't find referenced class android.content.Entity
Warning: com.mobclix.android.sdk.MobclixContactsEntityIterator: can't find referenced class android.content.Entity
Warning: com.mobclix.android.sdk.MobclixContactsSdk5: can't find referenced class android.content.Entity
Warning: com.mobclix.android.sdk.MobclixContactsSdk5: can't find referenced class android.content.Entity
Warning: com.mobclix.android.sdk.MobclixContactsSdk5: can't find referenced class android.content.Entity
Warning: com.mobclix.android.sdk.MobclixContactsSdk5: can't find referenced class android.content.Entity$NamedContentValues
Warning: com.mobclix.android.sdk.MobclixContactsSdk5: can't find referenced class android.content.Entity$NamedContentValues
Warning: com.mobclix.android.sdk.MobclixContactsSdk5: can't find referenced class android.content.Entity
Warning: com.mobclix.android.sdk.MobclixContactsSdk5: can't find referenced class android.content.Entity
Warning: com.mobclix.android.sdk.MobclixContactsSdk5: can't find referenced class android.content.Entity$NamedContentValues
Warning: com.mobclix.android.sdk.MobclixContactsSdk5: can't find referenced class android.content.Entity
You should check if you need to specify additional program jars.
Warning: there were 17 unresolved references to classes or interfaces.
You may need to specify additional library jars (using '-libraryjars'),
or perhaps the '-dontskipnonpubliclibraryclasses' option.
java.io.IOException: Please correct the above warnings first.
at proguard.Initializer.execute(Initializer.java:308)
at proguard.ProGuard.initialize(ProGuard.java:210)
at proguard.ProGuard.execute(ProGuard.java:85)
at proguard.ProGuard.main(ProGuard.java:499)
at com.android.ide.eclipse.adt.internal.build.BuildHelper.runProguard(BuildHelper.java:527)
at com.android.ide.eclipse.adt.internal.project.ExportHelper.exportReleaseApk(ExportHelper.java:187)
... 4 more
Now, I have put the Mobclix recommended bits from their documentation into my proguard.cfg:
-keep public class com.mobclix.android.sdk.*
-keep class com.mobclix.android.sdk.MobclixJavascriptInterface
-keepclassmembers class com.mobclix.android.sdk.MobclixJavascriptInterface
{
public void *(...);
<methods>;
}
-keepclassmembernames class
com.mobclix.android.sdk.MobclixJavascriptInterface {
public void *(...);
<methods>;
}
Anything else I should be doing? Thanks a million
The messages explain that some Mobclix classes (like com.mobclix.android.sdk.MobclixContactsCursorEntityIterator) depend on Android runtime classes (like android.content.Entity) that are not present in your input jars or library jars. In general, that could be a sign of serious problems: if that part of the code is ever executed, it will fail with NoClassDefFoundError (even without obfuscation).
It looks like the Entity class has been introduced in Android SDK 7, so I presume that you are building against an older SDK. Again assuming that your code runs fine in spite of this missing class, you can let ProGuard accept the somewhat inconsistent input with
-dontwarn android.content.Entity*
Note that -keep options don't come into play here. ProGuard performs the consistency checks before considering any -keep options.
Also see ProGuard manual > Troubleshooting > Warning: can't find referenced class
Maybe change
-keep public class com.mobclix.android.sdk.*
to
-keep public class com.mobclix.android.sdk.**