首页 > 解决方案 > 调试应用程序工作但发布应用程序不工作?

问题描述

我想在 gradle 文件中进行任何更改以使发布应用程序正常工作。我最近从普通应用程序转移到了 androidx。当我调试该应用程序并在我的手机中运行时,它可以正常工作,但是当我安装了发布应用程序时,它却无法正常工作,那么如何修复它?当我将我的应用程序移动到 android-x 时,它要求我将 setShiftingMode(false) 更改为 setShifting(false) 问题是否因此而发生。我该如何解决上述问题?

 buildscript {
        repositories {
            maven { url 'https://plugins.gradle.org/m2/'}
        }
    
        dependencies {
            classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.8, 0.99.99]'
        }
    }
    apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 29
    
        defaultConfig {
            applicationId "com.example.demo"
    
            manifestPlaceholders = [onesignal_app_id               : "fa5f9ac7-sdfdf-dfdf-exampleid-6f",
                                    // Project number pulled from dashboard, local value is ignored.
                                    onesignal_google_project_number: "REMOTE"]
            minSdkVersion 19
            targetSdkVersion 29
            versionCode 5
            versionName "5.1.11"
            testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
            multiDexEnabled true
        }
        android {
            lintOptions {
                checkReleaseBuilds false
                // Or, if you prefer, you can continue to check for errors in release builds,
                // but continue the build even when errors are found:
                abortOnError false
            }
        }
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
       }
    
        buildTypes {
            release {
                debuggable false
                shrinkResources true
                minifyEnabled true
                useProguard true
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    
    }
    
    dependencies {
        implementation fileTree(include: ['*.jar'], dir: 'libs')
        implementation 'androidx.appcompat:appcompat:1.0.0'
        implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'androidx.test.ext:junit:1.1.1'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
        implementation 'com.squareup.retrofit2:retrofit:2.4.0'
        implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
        implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
        implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.10.0'
        implementation 'com.google.android.material:material:1.0.0'
        implementation 'androidx.cardview:cardview:1.0.0'
        implementation 'com.github.bumptech.glide:glide:3.7.0'
        implementation 'com.jakewharton:butterknife:10.0.0'
        annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
        implementation 'com.github.clans:fab:1.6.4'
        implementation 'com.devbrackets.android:exomedia:4.2.1'
        implementation 'com.daimajia.numberprogressbar:library:1.4@aar'
        debugImplementation 'com.amitshekhar.android:debug-db:1.0.3'
        implementation 'com.miguelcatalan:materialsearchview:1.4.0'
        implementation project(':library')
        implementation('com.github.afollestad.material-dialogs:core:0.8.5.1@aar') {
            transitive = true
        }
        implementation 'org.jsoup:jsoup:1.11.1'
        implementation 'com.github.faruktoptas:FancyShowCaseView:1.0.1'
        implementation 'com.onesignal:OneSignal:[3.15.0, 3.99.99]'
        implementation 'com.google.android.gms:play-services-ads:19.3.0'
        implementation 'com.google.firebase:firebase-core:17.4.4'
        implementation 'com.loopj.android:android-async-http:1.4.9'
        implementation 'io.branch.sdk.android:library:2.+'
        implementation project(':jiaozivideoplayer')
    }
    apply plugin: 'com.google.gms.google-services'
    apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
    
    

标签: androidfirebasegradlebuild.gradle

解决方案


推荐阅读