使用com.google.android.gms.security.providerinstaller

问题描述 投票:0回答:1
class AppApplication : Application() { override fun onCreate() { super.onCreate() upgradeSecurityProvider() } private fun upgradeSecurityProvider() { ProviderInstaller.installIfNeededAsync(this@AppApplication, object : ProviderInstaller.ProviderInstallListener { override fun onProviderInstalled() { Log.i(TAG, "onProviderInstalled: WORKED!!!!!!!!!!!") } override fun onProviderInstallFailed(errorCode: Int, recoveryIntent: Intent?) { val message = " override fun onProviderInstallFailed($errorCode: Int, $recoveryIntent: Intent?) {}" Log.e(TAG, "onProviderInstallFailed: ", RuntimeException(message)) } }) } } private const val TAG = "AppApplication"
当执行该代码时,我会看到以下logcat条目:-

Considering local module com.google.android.gms.providerinstaller.dynamite:0 and remote module com.google.android.gms.providerinstaller.dynamite:0 Failed to load providerinstaller module: No acceptable module com.google.android.gms.providerinstaller.dynamite found. Local version is 0 and remote version is 0. Failed to report request stats: com.google.android.gms.common.security.ProviderInstallerImpl.reportRequestStats [class android.content.Context, long, long]
我看到了这个例外和警告: - 

E Failed to get service from broker. java.lang.SecurityException: Unknown calling package name 'com.google.android.gms'. at android.os.Parcel.createExceptionOrNull(Parcel.java:3069) at android.os.Parcel.createException(Parcel.java:3053) at android.os.Parcel.readException(Parcel.java:3036) at android.os.Parcel.readException(Parcel.java:2978) at asba.a(:com.google.android.gms@[email protected] (190400-721896117):36) at arzh.z(:com.google.android.gms@[email protected] (190400-721896117):143) at arha.run(:com.google.android.gms@[email protected] (190400-721896117):54) at android.os.Handler.handleCallback(Handler.java:958) at android.os.Handler.dispatchMessage(Handler.java:99) at bysy.mw(:com.google.android.gms@[email protected] (190400-721896117):1) at bysy.dispatchMessage(:com.google.android.gms@[email protected] (190400-721896117):5) at android.os.Looper.loopOnce(Looper.java:230) at android.os.Looper.loop(Looper.java:319) at android.os.HandlerThread.run(HandlerThread.java:67) W Failed to register com.google.android.gms.providerinstaller#com.google.android.gms eshc: 17: 17: API: Phenotype.API is not available on this device. Connection failed with: ConnectionResult{statusCode=DEVELOPER_ERROR, resolution=null, message=null} at eshe.a(:com.google.android.gms@[email protected] (190400-721896117):13) at fmak.d(:com.google.android.gms@[email protected] (190400-721896117):3) at fmam.run(:com.google.android.gms@[email protected] (190400-721896117):130) at fmcf.execute(:com.google.android.gms@[email protected] (190400-721896117):1) at fman.h(:com.google.android.gms@[email protected] (190400-721896117):1) at fman.l(:com.google.android.gms@[email protected] (190400-721896117):101) at fman.p(:com.google.android.gms@[email protected] (190400-721896117):19) at ekhy.hF(:com.google.android.gms@[email protected] (190400-721896117):35) at dzaw.run(:com.google.android.gms@[email protected] (190400-721896117):14) at fmcf.execute(:com.google.android.gms@[email protected] (190400-721896117):1) at dzax.b(:com.google.android.gms@[email protected] (190400-721896117):18) at dzbm.b(:com.google.android.gms@[email protected] (190400-721896117):36) at dzbo.c(:com.google.android.gms@[email protected] (190400-721896117):26) at arei.c(:com.google.android.gms@[email protected] (190400-721896117):9) at argy.q(:com.google.android.gms@[email protected] (190400-721896117):48) at argy.d(:com.google.android.gms@[email protected] (190400-721896117):10) at argy.g(:com.google.android.gms@[email protected] (190400-721896117):211) at argy.onConnectionFailed(:com.google.android.gms@[email protected] (190400-721896117):2) at arha.run(:com.google.android.gms@[email protected] (190400-721896117):82) at android.os.Handler.handleCallback(Handler.java:958) at android.os.Handler.dispatchMessage(Handler.java:99) at bysy.mw(:com.google.android.gms@[email protected] (190400-721896117):1) at bysy.dispatchMessage(:com.google.android.gms@[email protected] (190400-721896117):5) at android.os.Looper.loopOnce(Looper.java:230) at android.os.Looper.loop(Looper.java:319) at android.os.HandlerThread.run(HandlerThread.java:67) Caused by: arda: 17: API: Phenotype.API is not available on this device. Connection failed with: ConnectionResult{statusCode=DEVELOPER_ERROR, resolution=null, message=null} at aryt.a(:com.google.android.gms@[email protected] (190400-721896117):15) at arel.a(:com.google.android.gms@[email protected] (190400-721896117):1) at arei.c(:com.google.android.gms@[email protected] (190400-721896117):5) at argy.q(:com.google.android.gms@[email protected] (190400-721896117):48)  at argy.d(:com.google.android.gms@[email protected] (190400-721896117):10)  at argy.g(:com.google.android.gms@[email protected] (190400-721896117):211)  at argy.onConnectionFailed(:com.google.android.gms@[email protected] (190400-721896117):2)  at arha.run(:com.google.android.gms@[email protected] (190400-721896117):82)  at android.os.Handler.handleCallback(Handler.java:958)  at android.os.Handler.dispatchMessage(Handler.java:99)  at bysy.mw(:com.google.android.gms@[email protected] (190400-721896117):1)  at bysy.dispatchMessage(:com.google.android.gms@[email protected] (190400-721896117):5)  at android.os.Looper.loopOnce(Looper.java:230)  at android.os.Looper.loop(Looper.java:319)  at android.os.HandlerThread.run(HandlerThread.java:67) 
无论如何,我看到这些成功消息: - 

I Installed default security provider GmsCore_OpenSSL onProviderInstalled: WORKED!!!!!!!!!!!
最终记录了此重复的例外: - 

E Failed to get service from broker. java.lang.SecurityException: Unknown calling package name 'com.google.android.gms'. at android.os.Parcel.createExceptionOrNull(Parcel.java:3069) at android.os.Parcel.createException(Parcel.java:3053) at android.os.Parcel.readException(Parcel.java:3036) at android.os.Parcel.readException(Parcel.java:2978) at asba.a(:com.google.android.gms@[email protected] (190400-721896117):36) at arzh.z(:com.google.android.gms@[email protected] (190400-721896117):143) at arha.run(:com.google.android.gms@[email protected] (190400-721896117):54) at android.os.Handler.handleCallback(Handler.java:958) at android.os.Handler.dispatchMessage(Handler.java:99) at bysy.mw(:com.google.android.gms@[email protected] (190400-721896117):1) at bysy.dispatchMessage(:com.google.android.gms@[email protected] (190400-721896117):5) at android.os.Looper.loopOnce(Looper.java:230) at android.os.Looper.loop(Looper.java:319) at android.os.HandlerThread.run(HandlerThread.java:67)
我需要担心这些警告和错误消息吗?
看来默认安全提供商gmscore_openssl正在更新。

我做什么错误地导致这些处决?

我的gradle类似于以下内容:-
plugins {
    alias(libs.plugins.android.application)
    alias(libs.plugins.kotlin.android)
    alias(libs.plugins.kotlin.compose)
}

android {
    namespace = "com.my.app"
    compileSdk = 35

    defaultConfig {
        applicationId = "com.my.app"
        minSdk = 24
        targetSdk = 35
        versionCode = 1
        versionName = "1.0"

        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            isMinifyEnabled = false
            proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
        }
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_17
        targetCompatibility = JavaVersion.VERSION_17
    }
    kotlinOptions {
        jvmTarget = "17"
    }
    buildFeatures {
        compose = true
    }
}

dependencies {
    implementation("com.google.android.play:app-update:2.1.0")
    implementation("com.google.android.play:app-update-ktx:2.1.0")


    implementation(libs.androidx.core.ktx)
    implementation(libs.androidx.lifecycle.runtime.ktx)
    implementation(libs.androidx.activity.compose)
    implementation(platform(libs.androidx.compose.bom))
    implementation(libs.androidx.ui)
    implementation(libs.androidx.ui.graphics)
    implementation(libs.androidx.ui.tooling.preview)
    implementation(libs.androidx.material3)
    testImplementation(libs.junit)
    androidTestImplementation(libs.androidx.junit)
    androidTestImplementation(libs.androidx.espresso.core)
    androidTestImplementation(platform(libs.androidx.compose.bom))
    androidTestImplementation(libs.androidx.ui.test.junit4)
    debugImplementation(libs.androidx.ui.tooling)
    debugImplementation(libs.androidx.ui.test.manifest)
}

您正在正确调用

ProviderInstaller.installIfNeededAsync(...)

,然后更新安全提供商(请注意“已安装的默认安全提供商GMSCORE_OPENSSL”消息)。 “无法加载ProviderStaller模块”,“ SecurityException”和“ securitySype.api不可用”日志是Play Services中常见的内部警告。它们看起来令人震惊,但通常不有害或表示您的代码中的错误。只要触发

onProviderInstalled
并看到“已安装的默认安全提供程序”日志,就可以安全地忽略这些警告。
如果您想知道是什么真正造成这些日志……
android google-play
1个回答
0
投票
dynamite模块加载

“无法加载ProviderInstaller模块:找不到可接受的模块”消息出现了”消息,因为Google的ProviderInstaller试图加载Dynamite模块(Google Services交付功能/更新而没有完整的应用程序更新),但在您的上没有找到匹配版本设备。然后,它返回其默认的更新机制,该机制在最后取得了成功,因此“已安装的默认安全提供商gmscore_openssl”消息。


表型和开发人员错误

没有可用的有关“ phenotype.api”的警告,或者指示某些内部Google API(表型基本上是Google的功能标志/配置系统)在设备/模拟器上无法访问或支持。这些警告不会影响实际的安全提供商安装;它们更多地反映了设备上有限或受限环境。
  1. SecurityException:未知的呼叫软件包
  • 当Google Play Services尝试一些需要特定权限或包装验证的系统级调用时,这种情况通常会发生。在许多设备或模拟器上,OS无法将“ com.google.android.gms”验证为呼叫软件包,或者拒绝请求。 “ SecurityException”消息主要是内部日志,而不是停止该过程的崩溃。
    换句话说,日志只是Google Play服务的后备步骤中的内部噪声。由于您看到了成功消息,因此您的应用程序正在做正确的事情。无需担心这些警告或更改代码中的任何内容。
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.