Не работает реклама в release mode, Android

У меня есть приложение с рекламой, в debug mode, с тестовой рекламой всё работает как нужно, в release mode в скачанном из стора приложении, реклама не работает вообще. Почитал, поменял minifyEnabled и shrinkResources на false и залил в InternalSharing(поставил тестовою), реклама работает. Но при заливе в консоль, пишет предупреждение об отсутствие обфускации, из чего я понимаю что, надо вернуть minifyEnabled и shrinkResources в true, и что-то добавить в ProGuard, вопрос в том что добавить? Или причина может быть ещё в чём то, вроде всё настроено правильно? Спрашиваю в первую очередь потому что буквально неделю назад, в другом приложении, реклама работала как надо, с такими же настройками. Версия библиотеки: com.google.android.gms:play-services-ads:20.6.0


Ответы (1 шт):

Автор решения: Danil Apsadikov

Попробуйте добавить в ProGuard этот код:

#
#  Copyright (C) 2013 Google, Inc.
#
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.

# Add project specific ProGuard rules here.
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# 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 *;
#}

# The following rules are used to strip any non essential Google Play Services classes and method.

# For Google Play Services
-keep public class com.google.android.gms.ads.**{
   public *;
}

# For old ads classes
-keep public class com.google.ads.**{
   public *;
}

# For mediation
-keepattributes *Annotation*

# Other required classes for Google Play Services
# Read more at http://developer.android.com/google/play-services/setup.html
-keep class * extends java.util.ListResourceBundle {
   protected Object[][] getContents();
}

-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
   public static final *** NULL;
}

-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
   @com.google.android.gms.common.annotation.KeepName *;
}

-keepnames class * implements android.os.Parcelable {
   public static final ** CREATOR;
}
→ Ссылка