Instant App crashes when attempting to load Google Maps - android

We are preparing to publish our instant app, however, we are experiencing a security exception when attempting to initialize Google Maps. Below is the error that is occurring. After multiple attempts to resolve the issue and countless google searches, we have yet to find a solution. This issue is not happening for the installed app. Any help would be appreciated.
06-20 11:10:57.263 13891-13891/com.myapp.example.debug E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.myapp.example.debug, PID: 13891
java.lang.SecurityException: Failed to find provider com.google.android.gsf.gservices for user 0; expected to find a valid ContentProvider for this authority
The build.gradle file associated with the instant app:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.22.2'
}
}
apply plugin: 'com.android.instantapp'
apply plugin: 'io.fabric'
repositories {
jcenter()
flatDir {
dirs '../libs'
}
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}
android {
compileSdkVersion rootProject.compileSdk
buildToolsVersion rootProject.buildTools
def gitSha = 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim()
defaultConfig {
minSdkVersion rootProject.minSdk
targetSdkVersion rootProject.compileSdk
}
signingConfigs {
flavor1Release {
storeFile file('../publish/flavor1-release.keystore')
storePassword System.getenv("FLAVOR_1_STORE_PASSWORD")
keyAlias "flavor1"
keyPassword System.getenv("FLAVOR_1_KEY_PASSWORD")
v2SigningEnabled true
}
flavor2Release {
storeFile file('../publish/flavor2-release.keystore')
storePassword System.getenv("FLAVOR_2_STORE_PASSWORD")
keyAlias "flavor2"
keyPassword System.getenv("FLAVOR_2_KEY_PASSWORD")
v2SigningEnabled true
}
debug {
storeFile file('../publish/debug.keystore')
}
}
flavorDimensions rootProject.flavorDimensions
productFlavors {
flavor1 {
applicationId rootProject.flavor1PackageName
versionCode rootProject.flavor1VersionCode
versionName rootProject.flavor1VersionName
dimension rootProject.flavorDimensions
}
flavor2 {
applicationId rootProject.flavor2PackageName
versionCode rootProject.flavor2VersionCode
versionName rootProject.flavor2VersionName
dimension rootProject.flavorDimensions
}
}
buildTypes {
debug {
applicationIdSuffix ".debug"
versionNameSuffix "-debug-${gitSha}"
signingConfig signingConfigs.debug
}
release {
productFlavors.flavor1.signingConfig signingConfigs.flavor1Release
productFlavors.flavor2.signingConfig signingConfigs.flavor2Release
}
}
}
dependencies {
implementation project(':features:base')
implementation project(':features:auth')
implementation project(':features:chat')
implementation project(':features:filter')
implementation project(':features:search')
implementation project(':features:message')
}
Edit:
Resolved after updating gms libraries to 11.0.2

Related

Could not get unknown property 'fabricToolsVersion' for root project 'quickblox-android-sdk-master' of type org.gradle.api.Project

i am getting this error
Error:(7, 0) Could not get unknown property 'fabricToolsVersion' for root project 'quickblox-android-sdk-master' of type org.gradle.api.Project.
Open File
i recently migrated from android 2.3.3 to 3.0.1 the project was working fine. After migrating i got different errors after solving one i get a new error.
can anyone tell me how can i fix this?
here i my gradle.build
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath "io.fabric.tools:gradle:$rootProject.fabricToolsVersion"
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
flatDir { dirs 'libs' }
}
android {
compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion rootProject.buildToolsVersion
flavorDimensions rootProject.dimensionDefault
defaultConfig {
applicationId "com.quickblox.sample.chat"
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion
versionCode rootProject.versionCode
versionName rootProject.versionName
}
productFlavors {
speedDev {
dimension rootProject.dimensionDefault
minSdkVersion 21
}
dev {
dimension rootProject.dimensionDefault
minSdkVersion rootProject.minSdkVersion
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
minifyEnabled false
shrinkResources false
proguardFile 'proguard-rules.pro'
zipAlignEnabled false
}
release {
signingConfig signingConfigs.debug
}
}
signingConfigs {
debug {
storeFile file("../cert/debug.keystore")
storePassword "android"
keyAlias "androiddebugkey"
keyPassword "android"
}
}
lintOptions {
abortOnError false
}
}
dependencies {
implementation (project(":sample-core"))
implementation ("com.quickblox:quickblox-android-sdk-chat:$rootProject.qbSdkVersion")
implementation("com.quickblox:quickblox-android-sdk-content:$rootProject.qbSdkVersion")
implementation "com.github.orangegangsters:swipy:$rootProject.swipyVersion#aar"
implementation "com.github.bumptech.glide:glide:${rootProject.glideVersion}"
implementation (name: 'sticky-list-headers', ext: 'aar')
}
apply from: "../artifacts.gradle"
apply plugin: 'com.google.gms.google-services'
in string:
classpath "io.fabric.tools:gradle:$rootProject.fabricToolsVersion"
of your rootProject/build.gradle file, replace $rootProject.fabricToolsVersion
with
${rootProject.fabricToolsVersion} or 1.25.1.
That should result in:
classpath "io.fabric.tools:gradle:${rootProject.fabricToolsVersion}"
or classpath "io.fabric.tools:gradle:1.25.1".
Or you could create an external property by adding to rootProject/build.gradle parameter ext.fabricToolsVersion = '1.25.1'

Gradle can't see product flavors. How can I add them?

When I try to add a flavor to my project, Gradle simply don't want to sync and even if I sync it I can't see the flavor in Build Variats. What can cause this problem? The project has a few modules, I need to add flavors to the app. My file:
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.24.4'
}
}
repositories {
maven { url 'https://maven.fabric.io/public' }
}
def keystorePropertiesFile = "${rootDir}${File.separator}keystore.properties" as File
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
android {
dexOptions {
javaMaxHeapSize "4g"
}
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId ""
minSdkVersion 21
targetSdkVersion 25
versionCode 9999
versionName "17.2 (9999)"
}
productFlavors {
testFlavor {
applicationId "com.volodymyr.mobiletest"
}
}
def keystoreFilePath = "${System.properties['user.home']}${File.separator}${keystoreProperties['storeFile']}"
signingConfigs {
config {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreFilePath)
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
}
debug {
}
}
splits {
abi {
enable true
reset()
include 'armeabi-v7a', 'arm64-v8a'//, 'x86', 'x86_64'
universalApk true
}
}
lintOptions {
lintConfig file("lint.xml")
check "WrongConstant"
abortOnError true
}
}
tasks.whenTaskAdded { task ->
if(task.name.equals("assembleDebug")){
task.dependsOn(lint)
}
}
dependencies {
}
I deleted some info from here, like dependencies, id and so on just to show a structure.
Error:(15, 0) ProductFlavor names cannot start with 'test'
You should use another flavor name
The problem was in that that this gradle file is using only for CI. To change gradle config I needed to improve build file at settings.gradle.

How to select different buildTypes or productFlavors when uploadArchives?

I now just use AndroidStudio,here is my problem:
I have a android library but there are many different environment,eg debug,test,and release,each of these environments relate a different request url,and i use maven to manage my library,each of environment relate a different maven url,i want use productFlavors to appoint different request url then build different aars and upload to maven,but i donot know how to select the specific buildType or productFlavors when uploadArchives,if there are any other ways to solve my problem,please help me,thanks!
Here is build.gradle:
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
flavors_release {
resValue("string", "url", "http://....")
}
flavors_dev {
resValue("string", "url", "http://...")
}
}
uploadArchives {
repositories.mavenDeployer {
repository(url: 'http://127.0.0.1:8081/nexus/content/repositories/test/') {
authentication(userName: "admin",
password: "admin123")
}
pom.project {
name 'mylibrary'
packaging 'aar'
description ''
url 'http://127.0.0.1:8081/nexus/content/repositories/test/'
groupId ""
artifactId ''
version ""
}
}
I have solve my problem,i defined a buildConfigField:boolean TEST in defaultConfig,so in my java code,i can select the request url by judge TEST,and i can also select the local repositories address by judge TEST.Of cause,these values can be defined in the local.properties as the form of key=value!
I have Tried different type of builds using product flavors in android studio.
Ref Code:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "http://jzaccone.github.io/SlidingMenu-aar" }
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.test.testandroid" //your app id
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
signingConfigs {
debug {
storeFile file("/keystore/debug.keystore")
keyAlias 'androiddebugkey'
keyPassword 'android'
storePassword 'android'
}
googlePlayRelease {
storeFile file("/keystore/key.jks")
keyAlias 'android'
keyPassword 'android'
storePassword 'android'
}
}
buildTypes {
release {
minifyEnabled false
debuggable false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
debuggable true
}
}
productFlavors {
stagingBuild {
buildConfigField "boolean", "IS_DEMO", "false"
}
demoBuild {
buildConfigField "boolean", "IS_DEMO", "true"
versionCode 1
versionName "1.0"
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
}
You can select build type in Build variant to build the apk file.

Proguard doesn't build project with duplicate classes

I have one flavor for specific device. For this device I have .jar file which have custom android sdk(for this device. It contains some custom class which I have to use). And it works fine until I start use proguard. When I build project with proguard I receive this:
...
Note: there were 1504 duplicate class definitions.
...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:proguardAppProguard'.
> java.io.IOException: Please correct the above warnings first.
I found that adding a string:
-ignorewarnings
to proguard-android.txt fixes this problem, but it looks like bad solution. Did somebody face this(or similar) problem?
Edit
build.gradle:
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.2'
// The Fabric Gradle plugin uses an open ended version to react
// quickly to Android tooling updates
classpath 'io.fabric.tools:gradle:1.+'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'android-apt'
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
flatDir {
dirs 'libs'
}
}
apply plugin: 'idea'
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
configurations {
provided
}
sourceSets {
main {
compileClasspath += configurations.provided
runtimeClasspath += configurations.provided
}
}
def computeVersionName() {
return "r_1.0"
}
android {
compileSdkVersion 23
buildToolsVersion "21.1.1"
defaultConfig {
applicationId "com.app"
multiDexEnabled true
String buildSuf = System.getenv("BUILD_NUMBER");
ext.defaultName = project.archivesBaseName;
if (buildSuf != null) {
def vers = Integer.parseInt(buildSuf)
println "VERCODE = ${vers}"
versionCode vers
} else {
versionCode 1000
}
minSdkVersion 16
targetSdkVersion 21
}
productFlavors {
app {
applicationId "com.app"
versionName computeVersionName()
}
}
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
disable 'InvalidPackage'
}
signingConfigs {
...
customerProgurd {
storeFile file('../keys/debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
...
}
buildTypes {
...
customerProguard {
debuggable false
jniDebuggable false
minifyEnabled true
proguardFiles rootProject.file('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.customerProgurd
}
...
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
}
dependencies {
...
app files('libs/classes.jar') // it's custom sdk
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
...
}

Having troubles generating Android gradle signed and zipaligned apk

I am having trouble getting a signed zipaligned gradle file built in my Android app. I am using intellij 13.1.4. The error I am receiving is Error:(34, 0) Could not find property 'configstd' on BuildTypeDsl_Decorated{name=release, debuggable=false, jniDebugBuild=false, renderscriptDebugBuild=false, renderscriptOptimLevel=3, packageNameSuffix=null, versionNameSuffix=null, runProguard=false, zipAlign=true, signingConfig=null}.
Here is my build.gradle:
` buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 19
buildToolsVersion '20.0.0'
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
}
signingConfigs {
configstd {
keyAlias 'myalias'
keyPassword 'mykeypassword'
storeFile file('mykeyfile.jks')
storePassword 'mystorepassword'
}
}
buildTypes {
release {
debuggable false
zipAlign true
signingConfig configstd
}
debug {
debuggable true
zipAlign false
signingConfig configstd
}
}
}
dependencies {
compile 'com.android.support:support-v4:19.+'
compile 'com.android.support:appcompat-v7:19.+'
}
`
Here is what I discovered to be the problem. I originally had used the intellij's Project Structure->Facets->Android-Gradle to enter the parameters for the build.gradle file. Apparently, when it created the code to insert into the file it left off "signingConfigs" from the name of the object configstd. So in other words the line should read as follows:
signingConfig signingConfigs.configstd

Categories

Resources