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
Related
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'
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
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.
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'
...
}
I just updated my project to include the latest version of gradle however now I am receiving this error in yellow.
Gradle 'App' project refresh failed:
Neither path nor baseDir may be null or empty string. path='null' basedir='/Users/username/Desktop/App/app'
Gradle settings
When I click on the log, it takes me to the build.gradle file and moves the cursor to the signingConfigs > release section.
Below are my gradle files. For the life of me I cannot figure out what is wrong.
buildscript {
repositories {
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
}
}
apply plugin: 'android'
apply plugin: 'crashlytics'
repositories {
maven { url 'http://download.crashlytics.com/maven' }
}
android {
compileSdkVersion 19
buildToolsVersion '19.1.0'
defaultConfig {
minSdkVersion 11
targetSdkVersion 19
versionCode 9
versionName "2.0"
}
Properties debugProps = new Properties()
debugProps.load(new FileInputStream(project.file("debug.properties")))
Properties releaseProps = new Properties()
releaseProps.load(new FileInputStream(project.file("release.properties")))
signingConfigs {
debug {
storeFile file(debugProps.KEYSTORE_FILE)
storePassword debugProps.KEYSTORE_PASSWORD
keyAlias debugProps.KEY_ALIAS
keyPassword debugProps.KEY_PASSWORD
}
release {
storeFile file(releaseProps.KEYSTORE_FILE)
storePassword releaseProps.KEYSTORE_PASSWORD
keyAlias releaseProps.KEY_ALIAS
keyPassword releaseProps.KEY_PASSWORD
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
signingConfig signingConfigs.release
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:19.+'
compile 'com.android.support:support-v4:19.+'
compile 'com.crashlytics.android:crashlytics:1.+'
compile 'com.google.android.gms:play-services:+'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/joda-time-2.3.jar')
}
And for the build.gradle that contains the version
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
}
}
allprojects {
repositories {
mavenCentral()
}
}
When I build the app,the same problem blocked me too. Gradle log said that "Neither path nor baseDir may be null or empty string. path='null' basedir='XX/XX'". I tackled it.
In my situation ,the bad point located at build.gradle file of the app. The error log told me which line caused the error. I found that line referring a file path parameter, while the parameter is read from a properties file. But the parameter not exist in that properties file!!! That is the source of the problem. So I appended a parameter to the properties file. Problem solved.