4

When activating proguard (minifyEnabled = true) in my gradle configuration, the build fails in the step: :app:uploadCrashlyticsMappingFileRelease

the returned error is: java.io.IOException: Crashlytics could not read proxy port string

With minifyEnabled = false the app builds and runs correctly.

My gradle file (app)

apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-parcelize' apply plugin: 'kotlin-kapt' apply plugin: 'com.google.firebase.appdistribution' apply plugin: 'io.objectbox' apply plugin: 'realm-android' apply plugin: "androidx.navigation.safeargs" apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.firebase.crashlytics' android { compileSdkVersion 32 defaultConfig { applicationId project.getProperties().get('application_id') minSdkVersion 23 targetSdkVersion 32 versionCode Integer.parseInt(project.getProperties().get('version_code')) versionName project.getProperties().get('version_name') vectorDrawables.useSupportLibrary = true resValue 'string', 'application_name', project.getProperties().get('application_name') resValue 'string', 'application_id', project.getProperties().get('application_id') multiDexEnabled true } signingConfigs { release { storeFile file('../' + project.getProperties().get('store_file')) storePassword project.getProperties().get('store_password') keyAlias project.getProperties().get('key_alias') keyPassword project.getProperties().get('key_password') } } buildTypes { debug { debuggable true minifyEnabled false signingConfig signingConfigs.release } release { debuggable true minifyEnabled true shrinkResources false signingConfig signingConfigs.release proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' firebaseAppDistribution { releaseNotes = generateChangeLogShort() testers = "[email protected]" } } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } buildFeatures { viewBinding true } kotlinOptions { jvmTarget = '1.8' freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn" } } dependencies { // Kotlin implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" // KTX implementation 'androidx.core:core-ktx:1.8.0' implementation 'androidx.multidex:multidex:2.0.1' implementation 'androidx.appcompat:appcompat:1.4.2' implementation 'androidx.recyclerview:recyclerview:1.2.1' implementation 'androidx.cardview:cardview:1.0.0' implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' // Needed for https://github.com/FirebaseExtended/flutterfire/issues/4651 implementation 'androidx.browser:browser:1.4.0' // Firebase bug workaround for emulator, as described here: https://stackoverflow.com/questions/64668851/why-the-firestore-isnt-working-on-android-studio implementation "io.grpc:grpc-okhttp:1.44.1" // Import the BoM for the Firebase platform implementation platform('com.google.firebase:firebase-bom:30.1.0') // Declare the dependencies for the Crashlytics and Analytics libraries // When using the BoM, you don't specify versions in Firebase library dependencies implementation 'com.google.firebase:firebase-crashlytics' implementation 'com.google.firebase:firebase-analytics' implementation 'com.google.firebase:firebase-messaging' implementation 'com.google.firebase:firebase-functions' implementation 'com.google.firebase:firebase-firestore' implementation 'com.google.firebase:firebase-storage' implementation 'com.google.firebase:firebase-core' implementation 'com.google.firebase:firebase-auth' implementation 'com.firebaseui:firebase-ui-storage:6.2.1' implementation 'com.google.code.gson:gson:2.8.9' implementation 'com.google.android:flexbox:1.1.1' implementation 'com.google.android.gms:play-services-maps:18.0.2' implementation 'com.google.maps.android:android-maps-utils:0.6.2' implementation 'com.google.android.gms:play-services-places:17.0.0' implementation 'com.google.android.gms:play-services-location:20.0.0' implementation 'com.kbeanie:multipicker:1.5@aar' implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0' implementation 'org.greenrobot:eventbus:3.2.0' implementation 'io.michaelrocks:libphonenumber-android:8.10.7' implementation 'androidx.dynamicanimation:dynamicanimation:1.0.0' implementation 'com.afollestad.material-dialogs:core:0.9.6.0' implementation 'com.afollestad.material-dialogs:commons:0.9.6.0' implementation 'com.google.android.material:material:1.6.1' implementation 'com.github.bumptech.glide:glide:4.12.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'com.squareup.okhttp3:logging-interceptor:4.8.1' implementation 'com.squareup.okhttp3:okhttp:4.9.0' implementation 'org.apache.commons:commons-lang3:3.12.0' implementation 'com.google.firebase:firebase-config:21.1.0' // Navigation: def nav_version = "2.5.0" // Kotlin implementation "androidx.navigation:navigation-fragment-ktx:$nav_version" implementation "androidx.navigation:navigation-ui-ktx:$nav_version" // Feature module Support implementation "androidx.navigation:navigation-dynamic-features-fragment:$nav_version" // Testing Navigation androidTestImplementation "androidx.navigation:navigation-testing:$nav_version" // Places library implementation 'com.google.android.libraries.places:places:2.6.0' // PING Place Picker implementation project(path: ':pingplacepicker') //Wheel Picker implementation 'com.super_rabbit.wheel_picker:NumberPicker:1.0.1' kapt 'com.github.bumptech.glide:compiler:4.12.0' } def generateChangeLogShort(){ println "Generating release notes" def releaseNotes = "" def lastTagHash = "git rev-list --tags --skip=1 --max-count=1".execute().text.trim() println lastTagHash def lastTag = "git describe --abbrev=0 --tags $lastTagHash".execute().text.trim() println lastTag def cmdLine = "git log $lastTag..head --pretty=format:\"%s\"" def procCommit = cmdLine.execute() procCommit.in.eachLine { line -> //Remove surrounding quotation marks generated by the git log command def escapedLine = line.substring(1, line.length() - 1) //Escape backslashes escapedLine = escapedLine.replaceAll(/(\\)/, "\\/") //Escape quotation marks escapedLine = escapedLine.replaceAll('"', '\\\\"') //if (escapedLine.startsWith("feat:")) { releaseNotes += escapedLine + "\n" //} } println releaseNotes return releaseNotes } 

gradle file (project):

buildscript { ext { kotlin_version = '1.6.21' } repositories { mavenCentral() google() maven { url 'https://jitpack.io' } jcenter() } dependencies { def nav_version = '2.4.1' classpath 'com.android.tools.build:gradle:7.2.1' classpath 'com.google.gms:google-services:4.3.13' classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.1' classpath 'io.realm:realm-gradle-plugin:10.10.1' classpath 'io.objectbox:objectbox-gradle-plugin:2.9.1' classpath 'com.google.firebase:firebase-appdistribution-gradle:3.0.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version" } } allprojects { repositories { mavenCentral() google() maven { url 'https://maven.google.com/' } maven { url 'https://jitpack.io' } jcenter() } } repositories { mavenCentral() google() maven { url 'https://jitpack.io' } jcenter() } 

The error stack trace:

Caused by: java.io.IOException: Crashlytics could not read proxy port string. at com.google.firebase.crashlytics.buildtools.api.net.proxy.DefaultProxyFactory.create(DefaultProxyFactory.java:38) at com.google.firebase.crashlytics.buildtools.api.RestfulWebApi.sendFile(RestfulWebApi.java:91) at com.google.firebase.crashlytics.buildtools.api.RestfulWebApi.uploadFile(RestfulWebApi.java:119) at com.google.firebase.crashlytics.buildtools.api.FirebaseMappingFileService.uploadMappingFile(FirebaseMappingFileService.java:44) at com.google.firebase.crashlytics.buildtools.Buildtools.uploadMappingFile(Buildtools.java:208) at com.google.firebase.crashlytics.buildtools.Buildtools$uploadMappingFile$5.call(Unknown Source) at com.google.firebase.crashlytics.buildtools.gradle.tasks.UploadMappingFileTask.uploadMappingFile(UploadMappingFileTask.groovy:63) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104) ... 114 more 

UPDATE: Found out that issue is that the Crashlytics mapping file can't be uploaded because the proxy settings are not set in the Androdi Studio environment. But no proxy is being used, so have no idea what to specify for: systemProp.https.proxyPort systemProp.https.proxyHost

4
  • Are you behind a corporate network? There could be a firewall or a proxy that could be blocking these requests. Also, is this happening with the latest Crashlytics SDK version? Check this related to the domains used by Crashlytics: stackoverflow.com/a/74608162/4044241 Commented Nov 30, 2022 at 19:44
  • Did you ever solve your issue? Commented Jul 23, 2023 at 19:16
  • Any solution? @Emanuel how about you? Did you find out what is the root cause? Commented Aug 16, 2023 at 8:30
  • 1
    @Mahdi I posted an answer. Adding the firebase / crashlytics url's to nonProxyHosts settings fixed it in my case. Commented Aug 23, 2023 at 19:56

1 Answer 1

1

I found a solution to the problem. I'm behind a VPN and added proxy settings in gradle.properties (Project Properties). You can find my settings below. The whitelabeling of crashlytics was important in my case. (for security reasons I changed the corporate domains)

systemProp.http.proxyHost=some.web.proxy systemProp.http.proxyPort=8080 systemProp.https.proxyHost=some.web.proxy systemProp.https.proxyPort=8080 systemProp.http.nonProxyHosts=*.companydomain.com|localhost|*.crashlytics.com|crashlyticsreports-pa.googleapis.com|firebasecrashlyticssymbols.googleapis.com systemProp.https.nonProxyHosts=*.companydomain.com|localhost|*.crashlytics.com|crashlyticsreports-pa.googleapis.com|firebasecrashlyticssymbols.googleapis.com android.defaults.buildfeatures.buildconfig=true android.nonTransitiveRClass=false android.nonFinalResIds=false 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.