完全なエラー
Java.lang.NoSuchMethodError:静的メソッドなしasAttributeSet(Lt/g/a/a;)Landroid/util/AttributeSet;クラスLandroid/util/Xml;またはそのスーパークラス(「Android.util.Xml」の宣言は/system/framework/framework.jar!classes2.dexにあります)
Playバンドルにappbundleをアップロードしました。デバイスからアプリをダウンロードすると、アプリは次のようなログでクラッシュします...(ログはすべてのRedMIデバイスから収集されますAndroid os 9 、MIUI 11および10)
Java.lang.NoSuchMethodError: No static method asAttributeSet(Lt/g/a/a;)Landroid/util/AttributeSet; in class Landroid/util/Xml; or its super classes (declaration of 'Android.util.Xml' appears in /system/framework/framework.jar!classes2.dex)
at i.b.k.h.g.inflate(Unknown Source:21)
at xxx.yyyyyy.zzzzzz.qqqqqq.cccc.view.HomeActivity.onCreateOptionsMenu(Unknown Source:12)
at Android.app.Activity.onCreatePanelMenu(Activity.Java:3456)
at Android.support.v4.app.i.onCreatePanelMenu(Unknown Source:2)
at i.b.k.h.i.onCreatePanelMenu(Unknown Source:2)
at Android.support.v7.app.h$k.onCreatePanelMenu(Unknown Source:8)
at i.b.k.h.i.onCreatePanelMenu(Unknown Source:2)
at Android.support.v7.app.l.p(Unknown Source:25)
at Android.support.v7.app.l$a.run(Unknown Source:2)
at Android.os.Handler.handleCallback(Handler.Java:794)
at Android.os.Handler.dispatchMessage(Handler.Java:99)
at Android.os.Looper.loop(Looper.Java:176)
at Android.app.ActivityThread.main(ActivityThread.Java:6651)
at Java.lang.reflect.Method.invoke(Native Method)
at com.Android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.Java:547)
at com.Android.internal.os.ZygoteInit.main(ZygoteInit.Java:824)
app.gradle
apply plugin: 'com.Android.application'
apply plugin: 'kotlin-Android'
apply plugin: 'kotlin-Android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'io.fabric'
Android {
lintOptions {
checkReleaseBuilds false
abortOnError false
}
compileSdkVersion rootProject.ext.androidCompileSdkVersion
defaultConfig {
applicationId "xxx.yyyyyy.zzzzzz"
minSdkVersion rootProject.ext.androidMinSdkVersion
targetSdkVersion rootProject.ext.androidTargetSdkVersion
versionCode 1
versionName "1.0"
resValue "string", "app_name", "zzzzzz"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
kapt {
generateStubs = true
}
flavorDimensions "default"
productFlavors {
stage {
applicationId "xxx.yyyyyy.zzzzzz.stage"
versionCode 10000
versionName "3.0.55"
dimension "default"
}
dev {
applicationId "xxx.yyyyyy.zzzzzz.dev"
versionCode 10
versionName "3.0.20"
dimension "default"
}
prod {
applicationId "xxx.yyyyyy.zzzzzz"
versionCode 1000
versionName "3.1.12"
dimension "default"
}
}
dynamicFeatures = [":apphub"]
signingConfigs {
release {
storeFile file(getProjectDir().parent + "/Keystore/swipe.keystore")
}
}
buildTypes {
release {
minifyEnabled true
signingConfig signingConfigs.debug
applicationVariants.all { variant ->
renameAPK(variant)
}
}
}
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
dataBinding {
enabled = true
}
dexOptions {
javaMaxHeapSize "4g"
}
packagingOptions {
pickFirst 'lib/armeabi-v7a/libRSSupport.so'
pickFirst 'lib/arm64-v8a/libRSSupport.so'
pickFirst 'lib/x86_64/libRSSupport.so'
pickFirst 'lib/x86/libRSSupport.so'
pickFirst 'lib/mips/libRSSupport.so'
pickFirst 'lib/armeabi-v7a/librsjni.so'
pickFirst 'lib/arm64-v8a/librsjni.so'
pickFirst 'lib/x86_64/librsjni.so'
pickFirst 'lib/x86/librsjni.so'
pickFirst 'lib/mips/librsjni.so'
pickFirst 'lib/x86_64/librsjni_androidx.so'
pickFirst 'lib/armeabi-v7a/librsjni_androidx.so'
pickFirst 'lib/x86/librsjni_androidx.so'
pickFirst 'lib/arm64-v8a/librsjni_androidx.so'
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "com.Android.support:support-v4:$supportLibraryVersion"
implementation "com.Android.support.constraint:constraint-layout:$contraintLayoutVersion"
// Android Support libs
implementation "com.Android.support:appcompat-v7:$supportLibraryVersion"
implementation "com.Android.support:design:$supportLibraryVersion"
implementation "com.Android.support.constraint:constraint-layout:$contraintLayoutVersion"
implementation "com.Android.support:cardview-v7:$supportLibraryVersion"
implementation "com.Android.support:recyclerview-v7:$supportLibraryVersion"
// Kotlin libs
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// Retrofit, GSON and OkHttp
implementation "com.squareup.retrofit2:retrofit:$retrofitLibraryVersion"
implementation "com.google.code.gson:gson:$gsonLibraryVersion"
implementation "com.squareup.retrofit2:converter-gson:$retrofitLibraryVersion"
implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofitLibraryVersion"
implementation "io.reactivex.rxjava2:rxandroid:$rxAndroidVersion"
implementation "com.squareup.okhttp3:okhttp:$okHttpLibraryVersion"
implementation "com.squareup.okhttp3:logging-interceptor:$okHttpLibraryVersion"
// Architecture Libs
implementation "Android.Arch.lifecycle:extensions:$archVersion"
implementation "Android.Arch.persistence.room:runtime:$archVersion"
implementation "Android.Arch.lifecycle:runtime:$archVersion"
implementation "Android.Arch.persistence.room:rxjava2:$archVersion"
kapt "Android.Arch.lifecycle:compiler:$archVersion"
kapt "Android.Arch.persistence.room:compiler:$archVersion"
implementation "Android.Arch.paging:runtime:$pagingVersion"
implementation "Android.Arch.work:work-runtime-ktx:$workerVersion"
// Picasso
implementation "com.squareup.picasso:picasso:$picassoLibraryVersion"
//GCM libs
implementation "com.google.Android.gms:play-services-location:$playserviceLibraryVersion"
// Google places
implementation "com.google.Android.gms:play-services-places:$playserviceLibraryVersion"
//google auth
implementation 'com.google.Android.gms:play-services-auth:16.0.1'
// Exo player lib
implementation 'com.google.Android.exoplayer:exoplayer:2.9.1'
implementation 'com.pierfrancescosoffritti.androidyoutubeplayer:core:8.0.1'
implementation('com.crashlytics.sdk.Android:crashlytics:2.9.5@aar') {
transitive = true
}
// library for generating QR code
implementation 'com.google.zxing:core:3.3.0'
implementation 'com.journeyapps:zxing-Android-embedded:3.3.0@aar'
implementation 'com.intuit.sdp:sdp-Android:1.0.5'
implementation 'com.intuit.ssp:ssp-Android:1.0.5'
implementation 'com.github.bumptech.glide:glide:4.9.0'
implementation('com.github.bumptech.glide:okhttp3-integration:4.9.0') {
exclude group: 'glide-parent'
}
// MixPanel analytics & Play Service GCM
implementation 'com.mixpanel.Android:mixpanel-Android:5.4.1'
implementation "com.google.Android.gms:play-services-gcm:$playserviceLibraryVersion"
implementation "com.google.firebase:firebase-core:$firebaseCoreVersion"
implementation "com.google.firebase:firebase-messaging:$firebaseMessagingVersion"
// Skeleton view lib
implementation 'com.ethanhua:skeleton:1.1.1'
implementation 'io.supercharge:shimmerlayout:2.1.0'
//ProgressDialog
implementation 'com.wang.avi:library:2.1.3'
implementation 'com.facebook.Android:facebook-login:5.0.0'
implementation project(':banking')
implementation project(':content')
implementation project(':messaging')
implementation project(':shopping')
implementation project(':base')
implementation project(':travel')
implementation project(':event')
implementation 'com.github.GoodieBag:Pinview:v1.3'
debugImplementation 'com.amitshekhar.Android:debug-db:1.0.6'
implementation 'com.appsflyer:af-Android-sdk:4.9.0'
implementation 'com.Android.installreferrer:installreferrer:1.0'
implementation 'com.makeramen:roundedimageview:2.3.0'
implementation "ru.tinkoff.scrollingpagerindicator:scrollingpagerindicator:1.0.6"
implementation "com.daimajia.swipelayout:library:1.2.0@aar"
implementation 'io.branch.sdk.Android:library:3.1.0'
//dynamic feature
implementation 'com.google.Android.play:core:1.4.1'
}
repositories {
mavenCentral()
google()
maven { url 'https://maven.fabric.io/public' }
maven { url "https://jitpack.io" }
}
configurations {
compile.exclude group: 'androidx.annotation', module: 'annotation'
}
configurations.all {
resolutionStrategy.force 'com.Android.support:support-v4:28.0.0'
}
static def renameAPK(variant) {
variant.outputs.all { output ->
def formattedDate = new Date().format('dd-MM-YYYY')
def projectName = variant.mergedFlavor.resValues.get('app_name').getValue()
def projectVersionName = "_v" + variant.productFlavors.get(0).versionName
def projectBuildCode = "_b" + variant.productFlavors.get(0).versionCode
def buildDate = "_d" + formattedDate
def flavorsName = "_" + variant.productFlavors.get(0).name
def flavorsType = "_" + variant.variantData.variantConfiguration.buildType.name
def fileName = projectName + projectVersionName + projectBuildCode + buildDate + flavorsName + flavorsType + ".apk"
outputFileName = fileName
}
}
apply plugin: 'com.google.gms.google-services'
dynamicModule build.gradle(apphub)
apply plugin: 'com.Android.dynamic-feature'
apply plugin: 'kotlin-Android'
apply plugin: 'kotlin-Android-extensions'
apply plugin: 'kotlin-kapt'
androidExtensions {
experimental = true
}
Android {
compileSdkVersion rootProject.ext.androidCompileSdkVersion
defaultConfig {
minSdkVersion rootProject.ext.androidMinSdkVersion
targetSdkVersion rootProject.ext.androidTargetSdkVersion
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
}
flavorDimensions "default"
productFlavors {
stage {
applicationId "xxx.yyyyyy.zzzzzz.stage"
versionCode 10000
versionName "2.12"
dimension "default"
}
dev {
applicationId "xxx.yyyyyy.zzzzzz.dev"
versionCode 10
versionName "0.16"
dimension "default"
}
prod {
applicationId "xxx.yyyyyy.zzzzzz.apphub"
versionCode 1000
versionName "3.1.12"
dimension "default"
}
}
dataBinding {
enabled = true
}
kapt {
generateStubs = true
}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':app')
implementation project(':base')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "com.Android.support:appcompat-v7:$supportLibraryVersion"
implementation "com.Android.support.constraint:constraint-layout:$contraintLayoutVersion"
implementation "com.Android.support:design:$supportLibraryVersion"
implementation 'com.intuit.sdp:sdp-Android:1.0.5'
implementation 'com.intuit.ssp:ssp-Android:1.0.5'
implementation "com.squareup.picasso:picasso:$picassoLibraryVersion"
implementation "com.google.code.gson:gson:$gsonLibraryVersion"
implementation "Android.Arch.lifecycle:extensions:$archVersion"
implementation "com.Android.support:cardview-v7:$supportLibraryVersion"
implementation "com.squareup.retrofit2:retrofit:$retrofitLibraryVersion"
implementation "com.google.code.gson:gson:$gsonLibraryVersion"
implementation "com.squareup.retrofit2:converter-gson:$retrofitLibraryVersion"
implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofitLibraryVersion"
implementation "io.reactivex.rxjava2:rxandroid:$rxAndroidVersion"
implementation "com.squareup.okhttp3:okhttp:$okHttpLibraryVersion"
implementation "com.squareup.okhttp3:logging-interceptor:$okHttpLibraryVersion"
implementation 'com.jakewharton.rxbinding2:rxbinding:2.1.1'
implementation 'com.google.Android.exoplayer:exoplayer:2.9.1'
}
動的モジュールandroidManifest.xml(apphub)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:Android="http://schemas.Android.com/apk/res/Android"
xmlns:dist="http://schemas.Android.com/apk/distribution"
package="xxx.yyyyyy.zzzzzz.apphub">
<dist:module
dist:onDemand="false"
dist:instant="false"
dist:title="@string/title_app_hub">
<dist:fusing dist:include="true"/>
</dist:module>
<application>
<activity
Android:name="xxx.yyyyyy.zzzzzz.qqqqqqqqq.aaaaaaaaa.AppHubActivity"
Android:windowSoftInputMode="stateHidden|adjustPan"
Android:screenOrientation="portrait" />
</application>
</manifest>
モジュールランタイムをダウンロードする方法
private fun installDynamicModule(intent: Intent) {
val int:Intent = intent
var manager: SplitInstallManager = SplitInstallManagerFactory.create(this@MainActivity)
val request: SplitInstallRequest = SplitInstallRequest.newBuilder().addModule("apphub").build()
if (manager.installedModules.contains("apphub")) {
startActivity(int)
Log.e("main","main: activity start without download")
} else{
manager.startInstall(request)
.addOnSuccessListener {
Toast.makeText(this@MainActivity, "Download Success", Toast.LENGTH_SHORT).show()
Log.e("main","main: addOnSuccessListener")
}
.addOnFailureListener {
Toast.makeText(this@MainActivity, "Download Fail", Toast.LENGTH_SHORT).show()
Log.e("main","main: addOnFailureListener")
}
.addOnCompleteListener {
startActivity(int)
Toast.makeText(this@MainActivity, "Download Complete", Toast.LENGTH_SHORT).show()
Log.e("main","main: addOnCompleteListener")
}
}
アプリモジュールの監視
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/mavya.soni/Desktop/Software/AndroidTools/sdk/Android-sdk-macosx/tools/proguard/proguard-Android.txt
# 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 *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-keep class Sun.misc.Unsafe { *; }
-dontwarn Java.nio.file.*
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
-dontwarn okio.**
# OkHttp
-keepattributes Signature
-keepattributes *Annotation*
-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }
-dontwarn okhttp3.**
# Retrofit 2.X
## https://square.github.io/retrofit/ ##
-dontwarn retrofit2.**
-keep class retrofit2.** { *; }
-keepattributes Signature
-keepattributes Exceptions
-keepclasseswithmembers class * {
@retrofit2.http.* <methods>;
}
## Square Picasso specific rules ##
## https://square.github.io/picasso/ ##
-dontwarn com.squareup.okhttp.**
## Rxjava
-dontwarn Sun.misc.**
# rxjava
-keep class rx.schedulers.Schedulers {
public static <methods>;
}
-keep class rx.schedulers.ImmediateScheduler {
public <methods>;
}
-keep class rx.schedulers.TestScheduler {
public <methods>;
}
-keep class rx.schedulers.Schedulers {
public static ** test();
}
-keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* {
long producerIndex;
long consumerIndex;
}
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
long producerNode;
long consumerNode;
}
-keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* {
long producerIndex;
long consumerIndex;
}
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
rx.internal.util.atomic.LinkedQueueNode producerNode;
}
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueConsumerNodeRef {
rx.internal.util.atomic.LinkedQueueNode consumerNode;
}
-dontnote rx.internal.util.PlatformDependent
## Android architecture components: Lifecycle
# LifecycleObserver's empty constructor is considered to be unused by proguard
-keepclassmembers class * implements Android.Arch.lifecycle.LifecycleObserver {
<init>(...);
}
# ViewModel's empty constructor is considered to be unused by proguard
-keepclassmembers class * extends Android.Arch.lifecycle.ViewModel {
<init>(...);
}
# keep Lifecycle State and Event enums values
-keepclassmembers class Android.Arch.lifecycle.Lifecycle$State { *; }
-keepclassmembers class Android.Arch.lifecycle.Lifecycle$Event { *; }
# keep methods annotated with @OnLifecycleEvent even if they seem to be unused
# (Mostly for LiveData.LifecycleBoundObserver.onStateChange(), but who knows)
-keepclassmembers class * {
@Android.Arch.lifecycle.OnLifecycleEvent *;
}
-keepclassmembers class * implements Android.Arch.lifecycle.LifecycleObserver {
<init>(...);
}
-keep class * implements Android.Arch.lifecycle.LifecycleObserver {
<init>(...);
}
-keepclassmembers class Android.Arch.** { *; }
-keep class Android.Arch.** { *; }
-dontwarn Android.Arch.**
-keepclasseswithmembernames class * {
native <methods>;
}
-ignorewarnings
-keep class Android.support.v8.renderscript.** { *; }
-keep class com.crashlytics.** { *; }
-dontwarn com.crashlytics.**
### OKIO
# Java.nio.file.* usage which cannot be used at runtime. Animal sniffer annotation.
-dontwarn okio.Okio
# JDK 7-only method which is @hide on Android. Animal sniffer annotation.
-dontwarn okio.DeflaterSink
# com.google.zxing lib
# test thoroughly if you go this route.
-optimizations !code/simplification/cast,!field/*,!class/merging/*,!class/unboxing/enum,!code/allocation/variable,!method/marking/private
-optimizationpasses 5
-allowaccessmodification
-dontpreverify
# The remainder of this file is identical to the non-optimized version
# of the Proguard configuration file (except that the other file has
# flags to turn off optimization).
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-verbose
# ADDED
-dontshrink
#-dontobfuscate
-keepattributes *Annotation*
-keep public class com.google.vending.licensing.ILicensingService
-keep public class com.Android.vending.licensing.ILicensingService
# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
-keepclasseswithmembernames class * {
native <methods>;
}
# 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);
}
# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(Java.lang.String);
}
-keep class * implements Android.os.Parcelable {
public static final Android.os.Parcelable$Creator *;
}
-keepclassmembers class **.R$* {
public static <fields>;
}
-keep class Android.databinding.** { *; }
-keepnames class * implements Java.io.Serializable
-keepclassmembers class * implements Java.io.Serializable {
static final long serialVersionUID;
private static final Java.io.ObjectStreamField[] serialPersistentFields;
!static !transient <fields>;
private void writeObject(Java.io.ObjectOutputStream);
private void readObject(Java.io.ObjectInputStream);
Java.lang.Object writeReplace();
Java.lang.Object readResolve();
}
-keepattributes *Annotation*
#-keepattributes javax.xml.bind.annotation.*
#-keepattributes javax.annotation.processing.*
-keepclassmembers class * extends Java.lang.Enum { *; }
-keepclasseswithmembernames class Android.**
-keepclasseswithmembernames interface Android.**
#-dontobfuscate
-libraryjars <Java.home>/lib/rt.jar
-libraryjars <Java.home>/lib/jce.jar
-dontwarn
# The support library contains references to newer platform versions.
# Don't warn about those in case this app is linking against an older
# platform version. We know about them, and they are safe.
-dontwarn Android.support.**
#-printmapping prod/release/mapping/mapping.txt
-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.** { *; }
-keep class com.wang.avi.** { *; }
-keep class com.wang.avi.indicators.** { *; }
# Prevent proguard from stripping interface information from TypeAdapterFactory,
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer
##---------------End: proguard configuration for Gson ----------
-keep class * implements com.coremedia.iso.boxes.Box {* ; }
-dontwarn com.coremedia.iso.boxes.*
-dontwarn com.googlecode.mp4parser.authoring.tracks.mjpeg.**
-dontwarn com.googlecode.mp4parser.authoring.tracks.ttml.**
# Preserve annotations, line numbers, and source file names
-keepattributes *Annotation*,SourceFile,LineNumberTable
-keep class com.appsflyer.** { *; }
# Proguard rule for XMLResourceParser
-keep class org.xmlpull.v1.** { *; }
-dontwarn org.xmlpull.v1.**
-dontwarn com.Android.installreferrer.api.**
これは、Playストアからアプリをダウンロードした後にのみ発生します。デバッグでは正常に機能しますが、署名付きのApp Bundleでは機能しません。
これをproguard-rules.proファイルに追加する必要があります
-dontwarn org.xmlpull.v1.XmlPullParser
-dontwarn org.xmlpull.v1.XmlSerializer
-keep class org.xmlpull.v1.* {*;}