I have had a problem, when I generate a signed apk for release and install it directly on the device, it does not connect me with the rest services of my server, but if I generate the signed apk in debug, it connects me without problems, and if it is installed in android studio i still have no problem, does anyone know anything about this?
My config file:
build.gradle
// Top-level build file where you can add configuration options
common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
//classpath 'com.google.gms:google-services:2.0.0'
//classpath 'com.google.gms:google-services:2.0.0-beta2'
//classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they
belong
// in the individual module build.gradle files
//classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://github.com/QuickBlox/quickblox-android-sdk-
releases/raw/master/"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ext {
compileSdkVersion = 23
buildToolsVersion = "23.0.2"
minSdkVersion = 14
targetSdkVersion = 23
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
lintAbortOnError = false
// QuickBlox SDK version
qbSdkVersion = '2.6.1'
versionName = "2.6.1"
testRunnerVersion = "0.4.1"
// Dependency versions
playServicesVersion = '8.4.0'
//playServicesVersion = '9.0.2'
supportV4Version = '23.1.1'
appcompatV7Version = '23.1.1'
recyclerviewV7Version = '23.2.1'
supportAnnotationsVersion = '23.1.1'
designVersion = '23.1.1'
uilVersion = '1.9.0'
glideVersion = '3.6.1'
pullToRefreshVersion = '3.2.3'
stickyListHeaders = '2.7.0'
robotoTextViewVersion = '2.4.3'
stickersVersion = '0.7.3'
crashlyticsVersion = '2.2.2'
}
def makeJar(variant, project) {
//empty
}
module build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '26.0.2'
//buildToolsVersion "23.0.2"
defaultConfig {
applicationId "cibanco.com.mx.bcp"
minSdkVersion 14
targetSdkVersion 23
versionCode 9
versionName "3.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
flavorDimensions "tier"
productFlavors {
free {
dimension "tier"
}
full {
dimension "tier"
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
//compile 'com.google.android.gms:play-services:9.4.0'
//compile 'com.google.android.gms:play-services:9.2.1'
//compile 'com.google.android.gms:play-services-maps:9.4.0'
//compile 'com.google.firebase:firebase-ads:9.0.2'
//compile 'com.google.android.gms:play-services:9.0.2'
compile("com.quickblox:quickblox-android-sdk-core:$rootProject.qbSdkVersion")
compile("com.quickblox:quickblox-android-sdk-chat:$rootProject.qbSdkVersion")
compile("com.quickblox:quickblox-android-sdk-content:$rootProject.qbSdkVersion")
compile project(path: ':sample-core')
//compile "com.google.android.gms:play-services:${rootProject.playServicesVersion}"
compile "com.google.android.gms:play-services-maps:${rootProject.playServicesVersion}"
compile "com.google.android.gms:play-services-gcm:${rootProject.playServicesVersion}"
compile "com.github.bumptech.glide:glide:${rootProject.glideVersion}"
compile "se.emilsjolander:stickylistheaders:${rootProject.stickyListHeaders}"
//compile 'com.google.android.gms:play-services-maps:9.4.0'
//compile 'com.google.android.gms:play-services-gcm:9.4.0'
/*
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
*/
//compile 'com.google.android.gms:play-services-gcm:9.4.0'
//compile "me.leolin:ShortcutBadger:1.1.16@aar"
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:multidex:1.0.2'
compile 'com.github.orangegangsters:swipy:1.2.2@aar'
compile 'com.roomorama:caldroid:3.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
//apply plugin: 'com.google.gms.google-services'
build.gradle sample core
apply plugin: 'com.android.library'
android {
compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion rootProject.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion
versionCode 1
versionName "1.0"
}
buildToolsVersion '26.0.2'
}
dependencies {
compile ("com.quickblox:quickblox-android-sdk-
messages:$rootProject.qbSdkVersion" )
compile "com.google.android.gms:play-services-gcm:${rootProject.playServicesVersion}"
compile "com.android.support:design:${rootProject.designVersion}"
compile "com.github.johnkil.android-
robototextview:robototextview:${rootProject.robotoTextViewVersion}"
}
manifest
<?xml version="1.0" encoding="utf-8"?>
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<permission
android:name="android.permission.INTERACT_ACROSS_USERS_FULL"
android:protectionLevel="signature" />
<permission
android:name="cibanco.com.mx.bcp.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="cibanco.com.mx.bcp.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.VIBRATE" />
<application
android:name="com.quickblox.sample.chat.App"
android:allowBackup="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<!-- <uses-library android:name="com.google.android.maps" /> -->
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="editada" />
-->
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="editada" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity
android:name=".activity.LoginActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" />
<activity
android:name=".activity.MainActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".activity.OlvidoPass"
android:screenOrientation="portrait" />
<activity
android:name=".activity.EstadoOperacionActivity"
android:label="@string/title_activity_estado_operacion"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".activity.NotificacionesActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name="com.quickblox.sample.chat.ui.activity.SplashActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" />
<activity
android:name="com.quickblox.sample.chat.ui.activity.LoginActivity"
android:label="@string/login_title"
android:screenOrientation="portrait" />
<activity
android:name="com.quickblox.sample.chat.ui.activity.SelectUsersActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.quickblox.sample.chat.ui.activity.DialogsActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.quickblox.sample.chat.ui.activity.ChatActivity"
android:screenOrientation="portrait"
android:theme="@style/ChatActivityTheme"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name="com.quickblox.sample.chat.ui.activity.ChatInfoActivity"
android:label="@string/chat_info"
android:screenOrientation="portrait" />
<activity
android:name="com.quickblox.sample.chat.ui.activity.AttachmentImageActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.Dark" />
<receiver
android:name="com.google.android.gms.gcm.GcmReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="cibanco.com.mx.bcp" />
</intent-filter>
</receiver>
<service
android:name="com.quickblox.sample.chat.gcm.GcmPushListenerService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
<service
android:name="com.quickblox.sample.chat.gcm.GcmPushInstanceIDService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.gms.iid.InstanceID" />
</intent-filter>
</service>
<activity
android:name=".activity.RHMenuCapacitacion"
android:label="@string/title_activity_rhmenu_capacitacion"
android:theme="@style/AppTheme.NoActionBar" />
</application>
I solved it by disabling optimization, although it doesn't seem very optimal to me. Although now it connects without problems.