Android proguard error com.google.ads.util.i: and setMediaPlaybackRequiresUserGesture (boolean)

I am trying to create an APK file, but when I click Finish in the export dialog, I got an error and the APK is not created. At the moment, nothing can be found on the network, maybe someone can help here? Error:

Proguard returned with error code 1. See console Warning: com.google.ads.util.i: can't find referenced method 'void setMediaPlaybackRequiresUserGesture(boolean)' in class android.webkit.WebSettings You should check if you need to specify additional program jars. Warning: there were 1 unresolved references to program class members. Your input classes appear to be inconsistent. You may need to recompile them and try again. Alternatively, you may have to specify the option '-dontskipnonpubliclibraryclassmembers'. java.io.IOException: Please correct the above warnings first. at proguard.Initializer.execute(Initializer.java:321) at proguard.ProGuard.initialize(ProGuard.java:211) at proguard.ProGuard.execute(ProGuard.java:86) at proguard.ProGuard.main(ProGuard.java:492) 

I tried to add

 -dontskipnonpubliclibraryclassmembers 

but it didn’t help. I use Ads, this is a regular Android application, it works fine in the emulator.

My proguard.config is empty by default

 # To enable ProGuard in your project, edit project.properties # to define the proguard.config property as described in that file. # # Add project specific ProGuard rules here. # By default, the flags in this file are appended to flags specified # in ${sdk.dir}/tools/proguard/proguard-android.txt # You can edit the include path and order by changing the ProGuard # include property in project.properties. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html # Add any project specific keep options here: # If your project uses WebView with JS, uncomment the following # and specify the fully qualified class name to the JavaScript interface # class: #-keepclassmembers class fqcn.of.javascript.interface.for.webview { # public *; #} 

And my project.properties:

 # This file is automatically generated by Android Tools. # Do not modify this file -- YOUR CHANGES WILL BE ERASED! # # This file must be checked in Version Control Systems. # # To customize properties used by the Ant build system edit # "ant.properties", and override values to adapt the script to your # project structure. # # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt # Project target. target=android-16 

thanks

ps: are these default settings for android proguard safe enough to prevent a basic "hack"? (If I can make it workable)

+4
source share
2 answers

As you can see from the warning message, the Google Ads library refers to a method that is not in your target environment (android-16). This method exists only on android-17. You must specify the target android-17 or higher, so ProGuard can find the method and parse the code correctly.

If the application works for other purposes, you can still specify other goals in your AndroidManifest.xml.

ProGuard provides some basic protection against static analysis: it confuses identifiers and changes the structure of your code. For more protection, you can consider his commercial brother DexGuard , which adds additional protection against static analysis and dynamic analysis using methods such as string encryption, class encryption, and tamper detection. Nothing is indestructible, therefore, in the end, it is an economic compromise for you and potential hackers, time, effort, money, profit, experience, ...

(I'm a developer of ProGuard and DexGuard)

+10
source

I decided to add:

  -dontwarn com.google.ads.** 

after -verbose . For instance.

 -optimizationpasses 5 -dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -dontpreverify -verbose -dontwarn com.google.ads.** -optimizations !code/simplification/arithmetic,!field/*,!class/merging/* ... 
+1
source

Source: https://habr.com/ru/post/1468852/


All Articles