android - 已签名的 APK 在使用 back4app 时与 Android Studio 构建的行为不同,并在 google play 上发布。如何解决?

标签 android android-studio google-play release back4app

在 2016 年,我发布了一个使用 parse(和 parse.com)来存储一些数据的应用程序,它运行得非常好。我在 Google Play 上发布了它,下载量接近 5000 次。 2017 年,parse.com 被关闭。我没有时间转移到另一台服务器,所以我从 Google Play 取消了它的发布。 现在在 2018 年,我想把它带回网上。我发现 back4app.com 正在使用解析 API。我花了几个星期更新我的代码,现在当我在 Android Studio 上运行它并让它在我的手机上安装应用程序时它工作正常。 但是,昨天我在 google play 上发布了一个 beta 版本,我的一些 friend 说它不能正常工作。我在手机上检查了一下,发现当我直接从 google play 安装它时,我的 back4app 连接不起作用。

有解决办法吗?跟权限有关系吗?我不明白的是为什么当 android studio 安装它时它在我的手机上工作得很好,而当它直接从 google play 安装时它不与服务器通信。

下面我附上了我的 gradle,希望这里有问题。

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion '25.0.3'

    defaultConfig {
        applicationId "package.name"
        minSdkVersion 21
        targetSdkVersion 26
        multiDexEnabled true
        versionCode 13
        versionName "1.9.2"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dexOptions {
        // Prevent OutOfMemory with MultiDex during the build phase
        javaMaxHeapSize "2048"
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    // Fancy Button
    compile 'com.android.support:appcompat-v7:26.0.0'
    compile 'info.hoang8f:fbutton:1.0.5'
    // Parse
    // Compile 'com.parse.bolts:bolts-android:1.+'
    compile 'com.parse:parse-android:1.16.3' //update version to the latest one
    compile fileTree(dir: 'libs', include: 'Parse-*.jar')
    // AdBuddiz
    compile 'com.purplebrain.adbuddiz.sdk:AdBuddiz-Java:3.+'
    // Push
    compile 'com.parse.bolts:bolts-android:1.+'
    compile 'com.google.firebase:firebase-core:10.0.1'
    compile 'com.google.firebase:firebase-messaging:10.0.1'
    // Pushes Firebase service
    apply plugin: 'com.google.gms.google-services'
}

repositories {
    maven {
        url 'http://repository.adbuddiz.com/maven'
        }
    maven {
        url "http://maven.google.com"
        }
    jcenter()
}

最佳答案

在测试我的代码几个小时后,我终于发现了我的错误。

我错误地添加了 3 次相同的解析库,其中两次已过时,另一次是正确的。见下文:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar']) <- HERE
    // Fancy Button
    compile 'com.android.support:appcompat-v7:26.0.0'
    compile 'info.hoang8f:fbutton:1.0.5'
    // Parse
    // Compile 'com.parse.bolts:bolts-android:1.+'
    compile 'com.parse:parse-android:1.16.3' //update version to the latest one  <- THIS IS THE ONLY ONE I NEED!
    compile fileTree(dir: 'libs', include: 'Parse-*.jar')  <- HERE
    // AdBuddiz
    compile 'com.purplebrain.adbuddiz.sdk:AdBuddiz-Java:3.+'
    // Push
    compile 'com.parse.bolts:bolts-android:1.+'
    compile 'com.google.firebase:firebase-core:10.0.1'
    compile 'com.google.firebase:firebase-messaging:10.0.1'
    // Pushes Firebase service
    apply plugin: 'com.google.gms.google-services'
}

所以我所要做的就是删除这两个并留下正确的一个。见下文:

dependencies {
    // Fancy Button
    compile 'com.android.support:appcompat-v7:26.0.0'
    compile 'info.hoang8f:fbutton:1.0.5'
    // Parse
    // Compile 'com.parse.bolts:bolts-android:1.+'
    compile 'com.parse:parse-android:1.16.3' //update version to the latest one  <- THIS IS THE ONLY ONE I NEED!
    // AdBuddiz
    compile 'com.purplebrain.adbuddiz.sdk:AdBuddiz-Java:3.+'
    // Push
    compile 'com.parse.bolts:bolts-android:1.+'
    compile 'com.google.firebase:firebase-core:10.0.1'
    compile 'com.google.firebase:firebase-messaging:10.0.1'
    // Pushes Firebase service
    apply plugin: 'com.google.gms.google-services'
}

我几乎删除了这个问题,但我相信把它留在这里是很好的,它可以告诉我们有时候解决一个大问题真的很容易。您所需要的只是多注意一下您的代码 =/我的错!

关于android - 已签名的 APK 在使用 back4app 时与 Android Studio 构建的行为不同,并在 google play 上发布。如何解决?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49220340/

相关文章:

Android:从AsyncTask请求位置权限

android - 在代理上运行 Genymotion/MEmu

android - 关于如何在 android 中流式传输 m3u8 视频的任何想法

android - 导航查看菜单项,例如 Google Play 商店

android - google play 如何捕获我们手机上的异常?

android - 当我更改我的应用程序名称时会发生什么?

java - 将 Java 公共(public) DSA 或 RSA key 转换为 Node 可以理解的格式

java - 无法从 android php 连接插入 MySql Db

android-studio - 无法在空对象上调用方法 systemProperty() -- android studio 和 gradle

android - Android Studio内部构建失败(命令行有效)