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

签名构建APK失败求助:可运行及构建普通Release版,存在OkHttp警告

Fix for Failed Signed APK Build (With OkHttp3 Conscrypt Warnings)

Hey there, sorry to hear you're hitting this roadblock—being able to build regular release APKs but not signed ones is definitely frustrating, and those OkHttp warnings are likely tied to the issue. Let’s go through actionable fixes step by step:

1. Resolve the OkHttp3 Conscrypt Platform Warnings

These warnings pop up because OkHttp is trying to reference Conscrypt classes that aren’t present in your project, which can throw off the signing build process. Try one of these approaches:

  • Exclude Conscrypt if you don’t need it: Add an exclusion rule in your app-level build.gradle file to remove the unused Conscrypt dependency from OkHttp:
    implementation('com.squareup.okhttp3:okhttp:x.x.x') {
        exclude group: 'org.conscrypt', module: 'conscrypt-android'
    }
    
    (Replace x.x.x with your actual OkHttp version)
  • Add Conscrypt explicitly: If your project does rely on Conscrypt, add the dependency directly to build.gradle:
    implementation 'org.conscrypt:conscrypt-android:x.x.x'
    
  • Ignore the warnings in ProGuard: If the warnings are harmless but still blocking the build, add these lines to your proguard-rules.pro file:
    -dontwarn okhttp3.internal.platform.ConscryptPlatform
    -dontwarn org.conscrypt.**
    

2. Verify Your Signing Configuration

Double-check that your signing setup is 100% correct—small mistakes here often break signed builds even if regular releases work:

  • Open your app-level build.gradle and confirm the signingConfigs block has accurate details (file path, passwords, alias):
    signingConfigs {
        release {
            storeFile file('your-keystore-file.jks') // Make sure this path is correct
            storePassword 'your-store-password'
            keyAlias 'your-key-alias'
            keyPassword 'your-key-password'
        }
    }
    
    buildTypes {
        release {
            signingConfig signingConfigs.release // Ensure this is linked
            // Other release configs (minifyEnabled, etc.)
        }
    }
    
  • Alternatively, use Android Studio’s wizard: Go to Build > Generate Signed Bundle/APK, walk through the steps again, manually select your keystore file, and re-enter credentials to rule out typos.

3. Clean and Rebuild Your Project

Cached build files can cause weird inconsistencies between regular and signed builds:

  • First, run Build > Clean Project to wipe old build artifacts.
  • Then run Build > Rebuild Project to build from scratch.
  • If that doesn’t work, manually delete the .gradle and .build folders in your project root, restart Android Studio, and try again.

4. Check for Dependency Conflicts

Conflicting dependencies can interfere with the signing process. Run this command in your project terminal to generate a dependency tree:

# macOS/Linux
./gradlew app:dependencies

# Windows
gradlew.bat app:dependencies

Look for duplicate OkHttp or Conscrypt entries, and exclude duplicates using the exclude rule in your build.gradle like we did earlier.

5. Match Gradle and Android Plugin Versions

Mismatched versions of the Android Gradle Plugin (AGP) and Gradle itself can cause unexpected build failures. Check that your AGP version in build.gradle (Project level) matches the required Gradle version.

If none of these fixes work, sharing more details would help—like the full error message when the signed build fails (not just the warnings), your complete build.gradle files, or any changes you made to the project before this issue started.

内容的提问来源于stack exchange,提问作者Erol G

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.27 03:32:30