I was trying to publish a snapshot of a branch as a jitpack library, but during the build (initiated by jitpack) this error comes up in the logs when I click on get in the jitpack website.
What went wrong:
Execution failed for task ':openmrs-client:validateSigningRelease'.
Keystore file '/home/jitpack/build/release.keystore' not found for signing config 'release'.
I saw the build.gradle file as far as I can understand the release build depends upon the environment variables in travis. then how do I upload this snapshot to jitpack library?
I have seen most of the tutorials but none of them covers up this case :(
settings.gradle
include ':openmrs-android-sdk'
include ':openmrs-client'
build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.72'
ext.safeargs_version = '2.3.0'
System.properties['com.android.build.gradle.overrideVersionCheck'] = 'true'
repositories {
google()
jcenter()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$safeargs_version"
classpath "com.hiya:jacoco-android:0.2"
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
app level build.gradle
buildscript {
repositories {
jcenter()
maven {url 'https://oss.sonatype.org/content/repositories/snapshots'}
}
dependencies {
classpath 'com.github.triplet.gradle:play-publisher:2.2.1'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}
plugins {
id 'com.android.application'
id 'com.github.triplet.play' version '2.2.1'
id 'kotlin-android'
id 'kotlin-android-extensions'
// TODO AC-861
//id 'jacoco-android'
id 'com.hiya.jacoco-android'
}
apply from: './versions.gradle'
apply plugin: "androidx.navigation.safeargs"
def version = versions.appVersion
def GOOGLE_PLACE_API_KEY = System.getenv('GOOGLE_PLACE_API_KEY') ?: "YOUR_API_KEY"
android {
compileSdkVersion versions.compileSdk
def travisBuildNumber = System.getenv("TRAVIS_BUILD_NUMBER")
def buildNumber = (travisBuildNumber) ? (travisBuildNumber as int) : 1
def applicationVersion = version
def travisTag = System.getenv("TRAVIS_TAG")
def buildVersionName = (travisTag) ? travisTag : applicationVersion + "-debug." + buildNumber
defaultConfig {
applicationId "org.openmrs.mobile"
versionName buildVersionName
versionCode buildNumber
multiDexEnabled true
minSdkVersion versions.minSdk
targetSdkVersion versions.targetSdk
testApplicationId "org.openmrs.mobile.test"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
vectorDrawables.useSupportLibrary = true
javaCompileOptions {
annotationProcessorOptions {
arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
}
}
manifestPlaceholders = [
GOOGLE_PLACE_API_KEY: GOOGLE_PLACE_API_KEY
]
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
signingConfigs {
release {
storeFile rootProject.file('release.keystore')
storePassword System.getenv("KEYSTORE_PASSWORD")
keyAlias System.getenv("KEYSTORE_ALIAS_NAME")
keyPassword System.getenv("KEYSTORE_ALIAS_PASS")
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
signingConfig signingConfigs.release
}
debug {
testCoverageEnabled true
}
}
lintOptions {
warning 'InvalidPackage'
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/rxjava.properties'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
testOptions {
unitTests {
returnDefaultValues = true
includeAndroidResources = true
}
}
buildFeatures {
viewBinding = true
}
}
repositories {
maven { url 'http://yanzm.github.io/MaterialTabHost/repository' }
mavenCentral()
jcenter()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
google()
}
dependencies {
// Android sdk library dependency
implementation project(path: ':openmrs-android-sdk')
//more dependencies....
}
library module build.gradle
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'maven-publish'
}
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
minSdkVersion 17
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
dependencies {
//.. some dependencies..
}
afterEvaluate {
publishing {
publications {
release(MavenPublication) {
from components.release
groupId = 'com.openmrs.AndroidSDK'
artifactId = 'final'
version = '1.0.0'
}
debug(MavenPublication) {
from components.debug
groupId = 'com.openmrs.AndroidSDK'
artifactId = 'final-debug'
version = '1.0.0'
}
}
}
}
}
Related
What are the correct steps to add "com.github.persian-calendar:calendar:1.2.1" to an empty android project? I have tried different ways including this guide, but Gradle complains about all of them.
Build.gradle (project):
buildscript {
ext { compose_version = '1.2.0' }
}
plugins {
id 'com.android.application' version '7.4.0-alpha10' apply false
id 'com.android.library' version '7.4.0-alpha10' apply false
id 'org.jetbrains.kotlin.android' version '1.7.0' apply false
}
allprojects {
repositories {
maven("https://jitpack.io")
}
}
Build.gradle (module):
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
android {
namespace 'com.example.trash2'
compileSdk 32
defaultConfig {
applicationId "com.example.trash2"
minSdk 24
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary true
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion '1.2.0'
}
packagingOptions {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
}
}
}
dependencies {
implementation("com.github.persian-calendar:calendar:1.2.1")
...
}
Error:
org.gradle.api.GradleScriptException: A problem occurred evaluating root project 'trash2'. ...... Caused by: org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method maven() for arguments [https://jitpack.io] on repository container of type org.gradle.api.internal.artifacts.dsl.DefaultRepositoryHandler.
Step 1 :
Use maven { url 'https://jitpack.io' } instead of maven("https://jitpack.io")
Step 2 :
Put maven { url 'https://jitpack.io' } in settings.gradle :
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
I updated my targetSDKVersion and compileSdkVersion from 30 to 32, but now when I'm running the app, app:KaptDebugKotlin is failing. I used the debug-option to get more details and I'm receiving this error:
My build.gradle (module) file:
android {
compileSdkVersion 32
buildToolsVersion '29.0.3'
defaultConfig {
applicationId "com.eschbachit.petrolinemobile"
minSdkVersion 22
targetSdkVersion 32
versionCode 1628
versionName "2.3.0"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
buildTypes {
debug {
minifyEnabled false
debuggable true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildFeatures {
dataBinding true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
mavenCentral()
}
And this is my build.gradle (project) file:
buildscript {
ext.kotlin_version = '1.4.20-M1'
repositories {
jcenter()
google()
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
}
ext {
compiler_version = '3.1.3'
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.2'
classpath 'com.google.gms:google-services:4.3.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.android.tools.build:gradle:$compiler_version"
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.3.0'
}
My distributionURL is: distributionUrl=https://services.gradle.org/distributions/gradle-6.1.1-bin.zip
I tried different solutions from other answers but nothing worked for me
EDIT: This answer https://stackoverflow.com/a/69250502/15352563 solved my issue! If anybody have the same issue, this might help
I have been running into this error while trying to build my app and do not know how to resolve it, when I toggle Gradle offline mode, the error disappears but other dependency requires it to be turned off.
Could not GET 'https://google.bintray.com/exoplayer/com/google/gms/google-services/4.3.4/google-services-4.3.4.pom'. Received status code 502 from server: Bad Gateway
Disable Gradle 'offline mode' and sync project
This is my build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.6.1'
classpath 'com.android.tools.build:gradle:4.2.1'
classpath 'com.google.gms:google-services:4.3.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
maven { url "https://jitpack.io" }
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
This is my second buid.gradle
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/'}
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.9'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
repositories {
maven { url 'https://maven.google.com' }
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.crashlytics'
android {
signingConfigs {
release {
storeFile file('C:\\Users\\Osas Divine\\Desktop\\sckoolite\\unilorin-sckoolboy.jks')
storePassword '123456/'
keyAlias 'key0'
keyPassword '123456/'
}
}
compileSdkVersion 29
defaultConfig {
applicationId "com.sckoolboy.unilorin"
manifestPlaceholders = [onesignal_app_id: "d0989000-9ff3-4214-a42b-ed8f5a123456",
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: "REMOTE"]
minSdkVersion 19
targetSdkVersion 29
versionCode 11020
versionName '5.2.2'
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
archivesBaseName = "Sckoolboy"
useLibrary 'org.apache.http.legacy'
signingConfig signingConfigs.release
}
dexOptions {
jumboMode true
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
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
}
productFlavors {
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.github.vivchar:ViewPagerIndicator:1.1.0'
implementation 'com.squareup.retrofit2:retrofit:2.7.2'
implementation 'com.squareup.retrofit2:converter-gson:2.7.2'
implementation 'com.jakewharton.timber:timber:4.7.1'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.squareup.okhttp3:logging-interceptor:4.4.1'
..........
implementation('org.apache.httpcomponents:httpmime:4.3.6') {
exclude module: 'httpclient'
}
implementation 'org.apache.httpcomponents:httpclient-android:4.3.5'
// google maps library ------------------------------------------------------------------------
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation('com.google.android.libraries.places:places:1.0.0') {
exclude module: 'glide'
}
}
apply plugin: 'com.google.gms.google-services'
I am updating the dependencies in my android project. It is a multi-module project with clean architecture.
I have updated all the firebase library versions but whenever I change the com.google.gms:google-services the version from 4.1.0 to 4.2.0 Gradle sync fails with error code 1.
Here is the log of the IDE errors --
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
at com.google.android.gms.dependencies.DependencyInspector.registerDependencies(DependencyInspector.java:118)
at com.google.android.gms.dependencies.DependencyInspector.afterResolve(DependencyInspector.java:173)
at sun.reflect.GeneratedMethodAccessor103.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.event.DefaultListenerManager$ListenerDetails.dispatch(DefaultListenerManager.java:370)
at org.gradle.internal.event.DefaultListenerManager$ListenerDetails.dispatch(DefaultListenerManager.java:352)
at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:58)
2019-03-30 21:54:24,345 [ thread 70] INFO - System.util.ExternalSystemUtil - External project [/Users/d/C/A] resolution task executed in 4840 ms.
2019-03-30 21:54:24,345 [ thread 70] WARN - ect.sync.idea.ProjectSetUpTask - 1
2019-03-30 21:54:24,345 [ thread 70] INFO - e.project.sync.GradleSyncState - Gradle sync failed: 1
Project level Gradle file --
apply from: 'buildsystem/dependencies.gradle'
apply plugin: 'kotlin'
buildscript {\
ext.kotlin_version = '1.3.21'
repositories {
google()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
//maven { url 'https://dl.bintray.com/android/android-tools' }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.2.0'
classpath 'io.fabric.tools:gradle:1.+'
classpath "io.realm:realm-gradle-plugin:5.9.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6"
}
}
allprojects {
ext {
androidProductionApplicationId = '****'
androidStagingApplicationId = '****'
androidVersionCode = 264
androidVersionName = "3.0.0-beta"
}
}
repositories {
mavenCentral()
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
apply plugin: "org.sonarqube"
sonarqube {
properties {
property "sonar.host.url", "http://sonar.****.com/"
property "sonar.login", "*****"
property "sonar.projectKey", "android_test"
property "sonar.language", "java"
property "sonar.sources", "src/main"
}
}
App level Gradle file ---
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-kapt'
repositories {
google() //google's maven repo to use firebase and other google services
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
flatDir {
dirs 'libs'
}
jcenter()
}
android {
def globalConfiguration = rootProject.extensions.getByName("ext")
signingConfigs {
config {
keyAlias 'MyReleaseKey'
keyPassword '****'
storeFile file('../buildsystem/keystore.release.jks')
storePassword '****'
}
debugconfig {
keyAlias 'MyDebugKey'
keyPassword '****'
storeFile file('../buildsystem/keystore.debug.jks')
storePassword '****'
}
}
compileSdkVersion globalConfiguration.getAt("androidCompileSdkVersion")
buildToolsVersion = globalConfiguration.getAt("androidBuildToolsVersion")
defaultConfig {
applicationId globalConfiguration.getAt("androidProductionApplicationId")
versionCode globalConfiguration.getAt("androidVersionCode")
versionName globalConfiguration.getAt("androidVersionName")
minSdkVersion globalConfiguration.getAt("androidMinSdkVersion")
targetSdkVersion globalConfiguration.getAt("androidTargetSdkVersion")
multiDexEnabled true
defaultConfig {
ndk {
abiFilters "armeabi", "armeabi-v7a", "x86", "mips"
}
}
vectorDrawables.useSupportLibrary = true
resConfigs "en"
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),
'proguard-rules-presentation.txt'
signingConfig signingConfigs.config
resValue 'bool', 'GHOST_ENABLE', "false"
}
debug {
debuggable true
signingConfig signingConfigs.debugconfig
resValue 'bool', 'GHOST_ENABLE', "true"
}
}
flavorDimensions "default"
productFlavors {
staging {
applicationId globalConfiguration.getAt("androidStagingApplicationId")
resValue 'bool', 'CAN_CHANGE_HOST', "true"
}
production {
applicationId globalConfiguration.getAt("androidProductionApplicationId")
resValue 'bool', 'CAN_CHANGE_HOST', "false"
}
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
useLibrary 'org.apache.http.legacy'
bundle {
language {
enableSplit = false
}
}
androidExtensions {
experimental = true
}
}
sonarqube {
properties {
property "sonar.java.binaries", "build/intermediates/classes/staging/debug"
}
}
dependencies {
def presentationDependencies = rootProject.ext.presentationDependencies
implementation files('libs/YouTubeAndroidPlayerApi.jar')
implementation project(':data')
implementation project(':domain')
implementation(presentationDependencies.crashlytics) {
transitive = true;
}
implementation(presentationDependencies.multidex)
api(presentationDependencies.gson)
implementation(presentationDependencies.gcm)
implementation(presentationDependencies.fcm)
implementation(presentationDependencies.jsoup)
implementation(presentationDependencies.mixpanel)
implementation(presentationDependencies.facebook)
implementation(presentationDependencies.branch)
implementation(presentationDependencies.cardview)
implementation(presentationDependencies.recyclerview)
implementation(presentationDependencies.fab2)
implementation(presentationDependencies.design)
// implementation(presentationDependencies.appindexing)
implementation(presentationDependencies.eventbus)
implementation(presentationDependencies.exo)
implementation(presentationDependencies.firebaseauth)
implementation(presentationDependencies.firebasedatabase)
implementation(presentationDependencies.firebaseconfig)
implementation(presentationDependencies.firbaseinvites)
kapt(presentationDependencies.daggerCompiler)
implementation(presentationDependencies.rxAndroid)
implementation(presentationDependencies.rxJava2)
implementation(presentationDependencies.rxAndroid2)
implementation(presentationDependencies.butterKnife)
kapt(presentationDependencies.butterKnifeCompiler)
implementation(presentationDependencies.adapterDelegates)
implementation(presentationDependencies.firebaseCore)
implementation(presentationDependencies.fresco)
implementation(presentationDependencies.frescoAnimatedGif)
implementation(presentationDependencies.volley)
implementation(presentationDependencies.dagger)
implementation(presentationDependencies.isoparser)
implementation(presentationDependencies.kotlin)
implementation(presentationDependencies.lifecycle)
implementation(presentationDependencies.appCompat)
implementation(presentationDependencies.facebookShare)
implementation(presentationDependencies.placeAutoComplete)
implementation(presentationDependencies.googlePlayServiceAuth)
implementation(presentationDependencies.realmAdapters)
implementation(presentationDependencies.socketIo) {
exclude group: 'org.json', module: 'json'
}
implementation(presentationDependencies.lifecycleExtensions)
kapt (presentationDependencies.lifecycleCompiler)
implementation(presentationDependencies.constraintLayout)
}
apply plugin: 'com.google.gms.google-services'
After migrating my project to Android X, there was an error like in the title. gradle.app is as follows. I would be very happy if you could help. Thank you.
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.burakgon.hyperaudio"
minSdkVersion 16
targetSdkVersion 28
versionCode 1005
versionName "1005d"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
applicationVariants.all { variant ->
variant.outputs.all {
def version = variant.versionName
outputFileName = "hyperaudio-${version}.apk"
}
}
buildToolsVersion '28.0.3'
}
repositories {
maven {
url "https://jitpack.io"
}
}
ext {
supportLibVersion = '28.0.0' // variable that can be referenced to keep support libs consistent
}
You need to add the google() repo in the top level gradle file and also it should be before jcenter():
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.0.2'
}
}
allprojects {
repositories {
google()
jcenter()
}
}