You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Foreground Service的蓝牙App仅Release模式遭Google Protect拦截安装

问题:Google Protect判定Release包危险并拦截安装的原因

我开发了一款通过Foreground Service利用经典蓝牙4.0读取数据的App,每5秒通过AsyncTask内的HttpURLConnection将读取到的数据发送至专属服务器。工作流程为:用户选择并连接目标设备后,启动数据读取服务,之后每5秒向服务器发送数据。

Debug模式下App运行正常,Debug包通过文件管理器也能正常安装;但生成Release包后,文件管理器安装时会提示“应用危险”,Android 10可忽略提示完成安装,Android 11及以上则完全无法安装。


AndroidManifest.xml 声明的权限

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

build.gradle 配置

plugins {
    id 'com.android.application'
}

android {
    compileSdkVersion 33
    buildToolsVersion "33.0.1"

    defaultConfig {
        applicationId "construtec.com.br.monitoramentomobilev1e"
        minSdkVersion 21
        targetSdkVersion 33
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    applicationVariants.all { variant ->
        variant.outputs.all { output ->
            def project = "MonitoramentoMobile_v1e"

            def newApkName = project + ".apk"
         
            outputFileName = new File(newApkName)
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.5.0'
    implementation 'com.google.android.material:material:1.6.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

代码中动态申请的权限

WRITE_EXTERNAL_STORAGE、ACCESS_COARSE_LOCATION、ACCESS_FINE_LOCATION、INTERNET


核心疑问

想明确是什么原因导致Google Protect判定该App危险并拦截安装?重点是仅Release模式下出现此问题的原因,如需相关代码可提供。

内容的提问来源于stack exchange,提问作者Fabricius Lopes

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.28 14:52:48