「Android Getting Started SDK8」修訂間的差異

出自TAMedia
跳至導覽 跳至搜尋
 
(未顯示同一使用者於中間所作的 13 次修訂)
行 36: 行 36:
:<ul><li>lifecycle</li></ul>
:<ul><li>lifecycle</li></ul>
:<ul><li>viewModel ktx</li></ul>
:<ul><li>viewModel ktx</li></ul>
:<ul><li>appset id</ul>
:<ul><li>appset</ul>
 
== <b>Gradle設定</b> ==


<source>
<source>
行 78: 行 80:
     // app set id
     // app set id
     implementation 'com.google.android.gms:play-services-appset:16.0.1'
     implementation 'com.google.android.gms:play-services-appset:16.0.1'
    // Jetpack Security
    implementation "androidx.security:security-crypto:1.1.0-alpha03"
    // CVE-2023-3635
    implementation 'com.squareup.okio:okio:3.4.0'
}
}
</source>
</source>
行 144: 行 151:
<br>
<br>


== <b>Target API 為 31+ (Android 12以上) 的應用程式</b> ==
== <b>Target API 為 31+ (Android 12) 的應用程式</b> ==
: Target API 為 31+的開發者應用程式,請於AndroidManifest.xml中加入下列使用權限
: Target API 為 31+的開發者應用程式,請於AndroidManifest.xml中加入下列使用權限
<source>
<source>
行 166: 行 173:
<br>
<br>


== <b>Target API 為 34 (Android 14) 的應用程式 [[檔案:new-xxl.png|30px]] </b> ==
: Target API 為 34的開發者應用程式,請下載MADP 8.0.5 SDK, 並參考下面Gradle相依性設定, Proguard混淆設定
<br>
<br>
=== <b>Gradle設定</b> ===
<source>
    // =======================================================================//
    // APP library dependencies
    // =======================================================================//
    // madp aar
    implementation fileTree(include: ['*.aar'], dir: 'libs')
    // =======================================================================//
    // MADP library dependencies
    // =======================================================================//
    // retrofit
    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
    implementation 'com.squareup.retrofit2:converter-scalars:2.9.0'
    // google play service identifier
    implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
    // app set id
    implementation 'com.google.android.gms:play-services-appset:16.0.2'
    // gson
    implementation 'com.google.code.gson:gson:2.10.1'
    // jetpack security
    implementation "androidx.security:security-crypto:1.1.0-alpha06"
    // ActivityResultContracts
    implementation 'androidx.activity:activity-ktx:1.8.2'
</source>
<br>
=== <b>Proguard設定</b> ===
<source>
##---------------Begin: proguard for MADP  ----------
-dontoptimize
-optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*
-optimizationpasses 5
-dontusemixedcaseclassnames
-keepattributes *Annotation*,InnerClasses,EnclosingMethod,SourceFile,LineNumberTable
-dontpreverify
-verbose
-dontwarn android.support.**
-keep public class com.google.vending.licensing.ILicensingService
-keep public class com.android.vending.licensing.ILicensingService
-keeppackagenames com.taiwanmobile.pt.**, com.iab.omid.library.taiwanmobile.**
# keep setters in Views so that animations can still work.
# see http://proguard.sourceforge.net/manual/examples.html#beans
-keepclassmembers public class * extends android.view.View {
    void set*(***);
    *** get*();
}
# We want to keep methods in Activity that could be used in the XML attribute onClick
-keepclassmembers class * extends android.app.Activity {
    public void *(android.view.View);
}
-keep class * extends android.os.Parcelable {
    public static final android.os.Parcelable$Creator *;
}
-keepclassmembers class **.R$* {
    public static <fields>;
}
-keep public enum  com.taiwanmobile.pt.adp.view.TWMAdRequest$** {
    **[] $VALUES;
    public <fields>;
    public <methods>;
}
-keep class com.taiwanmobile.pt.adp.TWMMobileAds {
    public protected <fields>;
    public protected <methods>;
}
-keepclassmembers class com.taiwanmobile.pt.adp.TWMMobileAds {
    public static ** Companion;
}


-keep class com.taiwanmobile.pt.adp.view.*, com.taiwanmobile.pt.adp.view.inread.*, com.taiwanmobile.pt.adp.view.webview.**, com.taiwanmobile.pt.adp.nativead.* {
    public protected <fields>;
    public protected <methods>;
}
-keep class com.iab.omid.library.taiwanmobile.** {
    public protected <fields>;
    public protected <methods>;
}
# Also keep - Enumerations. Keep the special static methods that are required in
# enumeration classes.
-keepclassmembers enum  * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}
# Keep names - Native method names. Keep all native class/method names.
-keepclasseswithmembers,allowshrinking class * {
    native <methods>;
}
##---------------End: proguard for MADP  ----------
##---------------Begin: proguard for Retrofit  ----------
# Retrofit does reflection on generic parameters. InnerClasses is required to use Signature and
# EnclosingMethod is required to use InnerClasses.
-keepattributes Signature, InnerClasses, EnclosingMethod
# Retrofit does reflection on method and parameter annotations.
-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations
# Keep annotation default values (e.g., retrofit2.http.Field.encoded).
-keepattributes AnnotationDefault
# Retain service method parameters when optimizing.
-keepclassmembers,allowshrinking,allowobfuscation interface * {
    @retrofit2.http.* <methods>;
}
# Ignore annotation used for build tooling.
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
# Ignore JSR 305 annotations for embedding nullability information.
-dontwarn javax.annotation.**
# Guarded by a NoClassDefFoundError try/catch and only used when on the classpath.
-dontwarn kotlin.Unit
# Top-level functions that can only be used by Kotlin.
-dontwarn retrofit2.KotlinExtensions
-dontwarn retrofit2.KotlinExtensions$*
# With R8 full mode, it sees no subtypes of Retrofit interfaces since they are created with a Proxy
# and replaces all potential values with null. Explicitly keeping the interfaces prevents this.
-if interface * { @retrofit2.http.* <methods>; }
-keep,allowobfuscation interface <1>
# Keep generic signature of Call, Response (R8 full mode strips signatures from non-kept items).
-keep,allowobfuscation,allowshrinking interface retrofit2.Call
-keep,allowobfuscation,allowshrinking class retrofit2.Response
# With R8 full mode generic signatures are stripped for classes that are not
# kept. Suspend functions are wrapped in continuations where the type argument
# is used.
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation
##---------------End: proguard for Retrofit  ----------
##---------------Begin: proguard for Gson  ----------
# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all of it.
-keepattributes Signature
# For using GSON @Expose annotation
-keepattributes *Annotation*
# Gson specific classes
-dontwarn sun.misc.**
#-keep class com.google.gson.stream.** { *; }
# Application classes that will be serialized/deserialized over Gson
-keep class com.google.gson.examples.android.model.** { <fields>; }
# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory,
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
-keep class * extends com.google.gson.TypeAdapter
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer
# Prevent R8 from leaving Data object members always null
-keepclassmembers,allowobfuscation class * {
  @com.google.gson.annotations.SerializedName <fields>;
}
# Retain generic signatures of TypeToken and its subclasses with R8 version 3.0 and higher.
-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken
##---------------End: proguard for Gson  ----------
##---------------Begin: proguard for kotlinx.coroutines  ----------
# Allow R8 to optimize away the FastServiceLoader.
# Together with ServiceLoader optimization in R8
# this results in direct instantiation when loading Dispatchers.Main
-assumenosideeffects class kotlinx.coroutines.internal.MainDispatcherLoader {
    boolean FAST_SERVICE_LOADER_ENABLED return false;
}
-assumenosideeffects class kotlinx.coroutines.internal.FastServiceLoaderKt {
    boolean ANDROID_DETECTED return true;
}
-keep class kotlinx.coroutines.android.AndroidDispatcherFactory {*;}
# Disable support for "Missing Main Dispatcher", since we always have Android main dispatcher
-assumenosideeffects class kotlinx.coroutines.internal.MainDispatchersKt {
    boolean SUPPORT_MISSING return false;
}
# Statically turn off all debugging facilities and assertions
-assumenosideeffects class kotlinx.coroutines.DebugKt {
    boolean getASSERTIONS_ENABLED() return false;
    boolean getDEBUG() return false;
    boolean getRECOVER_STACK_TRACES() return false;
}
##---------------End: proguard for kotlinx.coroutines  ----------
##---------------Begin: proguard for Google ads  ----------
# 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;
}
##---------------End: proguard for Google ads  ----------
##---------------Begin: proguard for jetpack security  ----------
-dontwarn com.google.errorprone.annotations.Immutable
##---------------End: proguard for jetpack security  ----------
##---------------Begin: Gradle 8.2.1  ----------
-dontwarn java.lang.invoke.StringConcatFactory
##---------------End: Gradle 8.2.1  ----------
-dontwarn com.google.errorprone.annotations.CanIgnoreReturnValue
-dontwarn com.google.errorprone.annotations.CheckReturnValue
-dontwarn com.google.errorprone.annotations.RestrictedApi
</source>
<br>
== <b>資安相關</b> ==
=== CVE-2023-3635 ===
Square公司知名套件retrofit(處理網路API)其相依性套件okio有DDOS風險
<br>
解決辦法:
build.gradle中增加下列設定
<source>
    // CVE-2023-3635
    // implementation 'com.squareup.okio:okio:3.4.0'
</source>
參考資訊: https://nvd.nist.gov/vuln/detail/CVE-2023-3635
<br>
[[SDK8_Android_SDK_Developer_Guide | 回首頁]]
[[SDK8_Android_SDK_Developer_Guide | 回首頁]]

於 2024年7月16日 (二) 01:41 的最新修訂

簡介

TAmedia SDK提供Android Mobile App開發者簡易迅速的方式整合行動App廣告, 廣告的種類包含
  • Banner
  • Interstitial
  • InRead Anchor
  • Native


系統需求

Android 5.0以上 (API Level 21+)


SDK說明文件

SDK說明文件

Android Studio專案整合SDK

請按照下列方式設置專案

Step 1: 將SDK放入app專案的libs資料夾

請至下載 Download SDK下載SDK,並將壓縮檔內的AAR檔 (adpmobile-lib-r8.0.0.aar) 放至專案的libs資料夾, 若無libs資料夾請自行建立

AS SDK8 aar.png


Step 2-1: 編輯app專案中build.gradle

AS SDK8 gradle.png


請加入TAmedia SDK aar與下列相依性函式庫
  • kotlin
  • kotlin-coroutines
  • retrofit
  • google play service identifier
  • gson
  • lifecycle
  • viewModel ktx
  • appset

Gradle設定

dependencies {

    // =======================================================================//
    // MADP library
    // =======================================================================//
    implementation files('libs/adpmobile-lib-r8.0.0.aar')

    // =======================================================================//
    // MADP library dependencies
    // =======================================================================//
    // kotlin
    implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.10'
    // kotlin-coroutines
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.0"
    // retrofit
    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
    implementation 'com.squareup.retrofit2:converter-scalars:2.9.0'
    // google play service identifier
    implementation 'com.google.android.gms:play-services-ads-identifier:17.0.1'
    // gson
    implementation 'com.google.code.gson:gson:2.8.6'
    // lifecycle
    def lifecycle_version = "2.4.0-alpha03"
    def arch_version = "2.1.0"
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-service:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-process:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-reactivestreams-ktx:$lifecycle_version"
    testImplementation "androidx.arch.core:core-testing:$arch_version"
    // viewModel ktx extension
    implementation 'androidx.activity:activity-ktx:1.3.1'
    // app set id
    implementation 'com.google.android.gms:play-services-appset:16.0.1'
    // Jetpack Security
    implementation "androidx.security:security-crypto:1.1.0-alpha03"

    // CVE-2023-3635
    implementation 'com.squareup.okio:okio:3.4.0'
}


compileOptions請加入JAVA 8
  android {
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
  }


Step 2-2: 在Project的build.gradle的repositories內加入google()

Import SDK7 Step2-2.PNG


buildscript {
    ext.kotlin_version = "1.5.10"
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
    }
}




Step 3: 在AndroidManifest.xml的manifest tag宣告權限

Import SDK7 Step3-1.PNG

  • Required Permission
 <!-- TAmedia Required Permission -->
 <uses-permission android:name="android.permission.INTERNET" />
 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  • Optional Permission
 <!-- TAmedia Optional Permission -->
 <uses-permission android:name="android.permission.VIBRATE" /> 
 <uses-permission android:name="android.permission.CAMERA" />
 <uses-permission android:name="android.permission.RECORD_AUDIO" />
 <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> 
 <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />


Target API 為 31+ (Android 12) 的應用程式

Target API 為 31+的開發者應用程式,請於AndroidManifest.xml中加入下列使用權限
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>


Target API 為 31+的開發者應用程式,但是屬於 闔家適用計畫,或將兒童導向應用程式 請於AndroidManifest.xml中加入下列使用權限
<uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove"/>


Target API 為 30 以下的開發者應用程式,則不須增加此權限


詳情可參考Google網站說明:
2021 年 Google Play 服務更新
Google Play Policy - 家庭

Target API 為 34 (Android 14) 的應用程式 New-xxl.png

Target API 為 34的開發者應用程式,請下載MADP 8.0.5 SDK, 並參考下面Gradle相依性設定, Proguard混淆設定


Gradle設定

    // =======================================================================//
    // APP library dependencies
    // =======================================================================//
    // madp aar
    implementation fileTree(include: ['*.aar'], dir: 'libs')


    // =======================================================================//
    // MADP library dependencies
    // =======================================================================//
    // retrofit
    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
    implementation 'com.squareup.retrofit2:converter-scalars:2.9.0'
    // google play service identifier
    implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
    // app set id
    implementation 'com.google.android.gms:play-services-appset:16.0.2'
    // gson
    implementation 'com.google.code.gson:gson:2.10.1'
    // jetpack security
    implementation "androidx.security:security-crypto:1.1.0-alpha06"
    // ActivityResultContracts
    implementation 'androidx.activity:activity-ktx:1.8.2'


Proguard設定

##---------------Begin: proguard for MADP  ----------
-dontoptimize
-optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*
-optimizationpasses 5
-dontusemixedcaseclassnames
-keepattributes *Annotation*,InnerClasses,EnclosingMethod,SourceFile,LineNumberTable
-dontpreverify
-verbose
-dontwarn android.support.**

-keep public class com.google.vending.licensing.ILicensingService
-keep public class com.android.vending.licensing.ILicensingService
-keeppackagenames com.taiwanmobile.pt.**, com.iab.omid.library.taiwanmobile.**

# keep setters in Views so that animations can still work.
# see http://proguard.sourceforge.net/manual/examples.html#beans
-keepclassmembers public class * extends android.view.View {
    void set*(***);
    *** get*();
}

# We want to keep methods in Activity that could be used in the XML attribute onClick
-keepclassmembers class * extends android.app.Activity {
    public void *(android.view.View);
}

-keep class * extends android.os.Parcelable {
    public static final android.os.Parcelable$Creator *;
}

-keepclassmembers class **.R$* {
    public static <fields>;
}

-keep public enum  com.taiwanmobile.pt.adp.view.TWMAdRequest$** {
    **[] $VALUES;
    public <fields>;
    public <methods>;
}

-keep class com.taiwanmobile.pt.adp.TWMMobileAds {
    public protected <fields>;
    public protected <methods>;
}

-keepclassmembers class com.taiwanmobile.pt.adp.TWMMobileAds {
    public static ** Companion;
}

-keep class com.taiwanmobile.pt.adp.view.*, com.taiwanmobile.pt.adp.view.inread.*, com.taiwanmobile.pt.adp.view.webview.**, com.taiwanmobile.pt.adp.nativead.* {
    public protected <fields>;
    public protected <methods>;
}

-keep class com.iab.omid.library.taiwanmobile.** {
    public protected <fields>;
    public protected <methods>;
}

# Also keep - Enumerations. Keep the special static methods that are required in
# enumeration classes.
-keepclassmembers enum  * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

# Keep names - Native method names. Keep all native class/method names.
-keepclasseswithmembers,allowshrinking class * {
    native <methods>;
}
##---------------End: proguard for MADP  ----------




##---------------Begin: proguard for Retrofit  ----------
# Retrofit does reflection on generic parameters. InnerClasses is required to use Signature and
# EnclosingMethod is required to use InnerClasses.
-keepattributes Signature, InnerClasses, EnclosingMethod

# Retrofit does reflection on method and parameter annotations.
-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations

# Keep annotation default values (e.g., retrofit2.http.Field.encoded).
-keepattributes AnnotationDefault

# Retain service method parameters when optimizing.
-keepclassmembers,allowshrinking,allowobfuscation interface * {
    @retrofit2.http.* <methods>;
}

# Ignore annotation used for build tooling.
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement

# Ignore JSR 305 annotations for embedding nullability information.
-dontwarn javax.annotation.**

# Guarded by a NoClassDefFoundError try/catch and only used when on the classpath.
-dontwarn kotlin.Unit

# Top-level functions that can only be used by Kotlin.
-dontwarn retrofit2.KotlinExtensions
-dontwarn retrofit2.KotlinExtensions$*

# With R8 full mode, it sees no subtypes of Retrofit interfaces since they are created with a Proxy
# and replaces all potential values with null. Explicitly keeping the interfaces prevents this.
-if interface * { @retrofit2.http.* <methods>; }
-keep,allowobfuscation interface <1>

# Keep generic signature of Call, Response (R8 full mode strips signatures from non-kept items).
-keep,allowobfuscation,allowshrinking interface retrofit2.Call
-keep,allowobfuscation,allowshrinking class retrofit2.Response

# With R8 full mode generic signatures are stripped for classes that are not
# kept. Suspend functions are wrapped in continuations where the type argument
# is used.
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation
##---------------End: proguard for Retrofit  ----------



##---------------Begin: proguard for Gson  ----------
# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all of it.
-keepattributes Signature

# For using GSON @Expose annotation
-keepattributes *Annotation*

# Gson specific classes
-dontwarn sun.misc.**
#-keep class com.google.gson.stream.** { *; }

# Application classes that will be serialized/deserialized over Gson
-keep class com.google.gson.examples.android.model.** { <fields>; }

# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory,
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
-keep class * extends com.google.gson.TypeAdapter
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer

# Prevent R8 from leaving Data object members always null
-keepclassmembers,allowobfuscation class * {
  @com.google.gson.annotations.SerializedName <fields>;
}

# Retain generic signatures of TypeToken and its subclasses with R8 version 3.0 and higher.
-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken
##---------------End: proguard for Gson  ----------



##---------------Begin: proguard for kotlinx.coroutines  ----------
# Allow R8 to optimize away the FastServiceLoader.
# Together with ServiceLoader optimization in R8
# this results in direct instantiation when loading Dispatchers.Main
-assumenosideeffects class kotlinx.coroutines.internal.MainDispatcherLoader {
    boolean FAST_SERVICE_LOADER_ENABLED return false;
}

-assumenosideeffects class kotlinx.coroutines.internal.FastServiceLoaderKt {
    boolean ANDROID_DETECTED return true;
}

-keep class kotlinx.coroutines.android.AndroidDispatcherFactory {*;}

# Disable support for "Missing Main Dispatcher", since we always have Android main dispatcher
-assumenosideeffects class kotlinx.coroutines.internal.MainDispatchersKt {
    boolean SUPPORT_MISSING return false;
}

# Statically turn off all debugging facilities and assertions
-assumenosideeffects class kotlinx.coroutines.DebugKt {
    boolean getASSERTIONS_ENABLED() return false;
    boolean getDEBUG() return false;
    boolean getRECOVER_STACK_TRACES() return false;
}
##---------------End: proguard for kotlinx.coroutines  ----------



##---------------Begin: proguard for Google ads  ----------
# 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;
}
##---------------End: proguard for Google ads  ----------

##---------------Begin: proguard for jetpack security  ----------
-dontwarn com.google.errorprone.annotations.Immutable
##---------------End: proguard for jetpack security  ----------

##---------------Begin: Gradle 8.2.1  ----------
-dontwarn java.lang.invoke.StringConcatFactory
##---------------End: Gradle 8.2.1  ----------
-dontwarn com.google.errorprone.annotations.CanIgnoreReturnValue
-dontwarn com.google.errorprone.annotations.CheckReturnValue
-dontwarn com.google.errorprone.annotations.RestrictedApi


資安相關

CVE-2023-3635

Square公司知名套件retrofit(處理網路API)其相依性套件okio有DDOS風險
解決辦法: build.gradle中增加下列設定

    // CVE-2023-3635
    // implementation 'com.squareup.okio:okio:3.4.0'

參考資訊: https://nvd.nist.gov/vuln/detail/CVE-2023-3635


回首頁