1

Недавно мы перешли от бесплатной библиотеки карт Google к картам для работы. Я изменил импорт с com.google.android.gms.maps на com.google.android.m4b.maps и импортировал скомпилированную библиотеку aar. У нас есть действующая лицензия.Настройки Android Proguard для Карт Google для работы

Единственное, что я не нашел в документах, это настройки proguard, и у меня возникают проблемы с ним. После некоторых исследований я сделал конфигурацию «слепой догадок» с добавлением строк:

-dontwarn sun.misc.Unsafe 
-keep class com.google.android.m4b.common.** { *; } 
-keep class com.google.android.m4b.ads.identifier.** { *; } 
-keep class com.google.android.m4b.maps.** { *; } 
-keep class com.google.android.m4b.** { *; } 
-keep class com.google.android.geo.** { *; } 
-keep class android.support.v4.** { *; } 
-keepattributes InnerClasses 
-dontoptimize 

Он компилирует каким-то образом (APK создается), но Gradle еще возвращает ошибку:

AGPBI: {"kind":"error","text":"warning: Ignoring InnerClasses attribute for an anonymous inner class","sources":[{}]} 
AGPBI: {"kind":"error","text":"(com.google.android.m4b.maps.ca.a) that doesn\u0027t come with an","sources":[{}]} 
AGPBI: {"kind":"error","text":"associated EnclosingMethod attribute. This class was probably produced by a","sources":[{}]} 
AGPBI: {"kind":"error","text":"compiler that did not target the modern .class file format. The recommended","sources":[{}]} 
AGPBI: {"kind":"error","text":"solution is to recompile the class from source, using an up-to-date compiler","sources":[{}]} 
AGPBI: {"kind":"error","text":"and without specifying any \"-target\" type options. The consequence of ignoring","sources":[{}]} 
AGPBI: {"kind":"error","text":"this warning is that reflective operations on this class will incorrectly","sources":[{}]} 
AGPBI: {"kind":"error","text":"indicate that it is *not* an inner class.","sources":[{}]} 

Во всяком случае, я не» я хочу полагаться на слепую догадку, и я не эксперт по защите. Есть ли официальное руководство для карт для работы?

Если нет - какие строки над «угадываемой» конфигурацией proguard мне нужно сохранить, чего мне не хватает, а какие строки я могу от них избавиться?

ответ

0

Если вы используете Android Studio, как указано в Setting Up Google Play Services,

ProGuard directives are included in the Play services client libraries to preserve the required classes. The Android Plugin for Gradle automatically appends ProGuard configuration files in an AAR (Android ARchive) package and appends that package to your ProGuard configuration. During project creation, Android Studio automatically creates the ProGuard configuration files and build.gradle properties for ProGuard use. To use ProGuard with Android Studio, you must enable the ProGuard setting in your build.gradle buildTypes. For more information, see the ProGuard guide .

В любых других случаях, вы можете также проверить эти дополнительные ссылки:

0

это "ошибка" на самом деле является предупреждение (как сообщение читает) ...

вы, возможно, придется отключить оптимизацию, пока вопрос # 215748 не было исправлено:

-keepattributes InnerClasses 
-dontoptimize 
Смежные вопросы