When I commit and push changes to gitlab,assembly falls with an error:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':somebible-id-client-app'.
> Could not resolve all dependencies for configuration ': somebible-id-client-app:_secondaryDebugApkCopy'.
> Could not resolve ru.somebible.android:statistic:0.0.5.
Required by:
project :somebible-id-client-app
> Skipped due to earlier error
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 22s
ERROR: Job failed: exit code 1
My build.gradle:
buildscript {
repositories {
mavenCentral()
maven {
url 'http://jenkins01.mobile.somebible.ru:7700/nexus/content/repositories/somebible-internal/'
}
google()
jcenter()
maven { url "https://jitpack.io" }
}
dependencies {
classpath 'me.tatarka:gradle-retrolambda:3.2.5'
}
}
repositories {
mavenCentral()
maven {
url 'http://jenkins01.mobile.somebible.ru:7700/nexus/content/repositories/somebible-internal/'
}
google()
jcenter()
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'idea'
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
android {
compileSdkVersion 25
buildToolsVersion '25.0.3'
defaultConfig {
applicationId "ru.somebible.somebibleidclientapp"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
debug {
useProguard false
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
prod {
resValue "string", "app_name", "Id Client App"
}
secondary {
applicationId "ru.somebible.somebibleidclientappsecondary"
resValue "string", "app_name", "Id Client Secondary App"
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
abortOnError false
}
dependencies {
ext.support_version = '25.3.1'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':somebible-id')
apt 'com.jakewharton:butterknife-compiler:8.0.1'
compile "com.android.support:appcompat-v7:$ext.support_version"
compile "com.android.support:design:$ext.support_version"
compile 'com.jakewharton:butterknife:8.0.1'
compile 'io.reactivex:rxjava:1.1.3'
compile 'io.reactivex:rxandroid:1.1.0'
compile 'com.hannesdorfmann.mosby:mvp:2.0.1'
compile 'com.annimon:stream:1.1.2'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'ru.somebible.android:statistic:0.0.5'
testCompile 'junit:junit:4.12'
}
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
And most importantly, there is no such process, even without the prefix ApkCopy. That is, to see what the problem is locally impossible, since locally there is no such process and locally everything works. Direct please in the right direction.
Thank you for answers!
Gradle is trying to download the artifact ru.somebible.android:statistic but fails to do so because it can't find it in any known artifact repository. I assume that the artifact is published in this repository: 'http://jenkins01.mobile.somebible.ru:7700/nexus/content/repositories/somebible-internal/'
In that case, make sure that your build machine has access to this repository and make sure that that artifact can actually be found in that repository.
Related
I have problem with configuration of android project. I upgraded Android Studio [AS] from v2 to v3 and got many problems. I changed gradle as is in documentation:
gradle-wrapper, gradle plugin version, repositories google or jcenter instead of maven. Please look at configuration:
I have project called mytwayapp which have build.gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
//{ url "http://jcenter.bintray.com/" }
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
dependencies {
implementation project(':app')
}
Next I have module called app with build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '27.0.3'
// buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.mytway.activity.registerformactivity"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
preDexLibraries = false;
javaMaxHeapSize "2g"
}
sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/res/assets/fonts'] } }
testOptions {
unitTests.returnDefaultValues = true
}
lintOptions {
abortOnError false
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.google.android.gms:play-services:8.4.0'
implementation 'com.android.support:appcompat-v7:23.1.1'
implementation 'com.android.support:support-v4:23.1.1'
implementation 'com.android.support:support-v13:23.1.1'
implementation 'joda-time:joda-time:2.9.4'
implementation files('../libs/MPAndroidChart-v3.0.1.jar')
//to remove when Dex is over memory
testImplementation group: 'org.powermock', name: 'powermock-api-easymock', version: '1.6.6'
testImplementation 'org.powermock:powermock-mockito-release-full:1.5.4'
testImplementation 'org.powermock:powermock-api-mockito:1.6.6'
testImplementation 'org.powermock:powermock-module-junit4:1.5.1'
testImplementation 'org.mockito:mockito-all:1.9.5'
testImplementation 'org.powermock:powermock-mockito-release-full:1.6.1'
testImplementation 'org.easymock:easymock:3.1'
// testCompile files('build/lib/powermock-easymock-1.6.6-full.jar')
testImplementation 'junit:junit:4.12'
}
Next is gradle-wrapper:
#Thu Mar 16 20:14:22 CET 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
Problem:
I cannot sync with gradle,If I try then error:
Could not initialize class com.android.tools.idea.gradle.eclipse.GradleImport
When I try install from cmd, then:
./gradlew install -x test
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\android\BitBucket\mytwayapp\build.gradle' line: 22
* What went wrong:
A problem occurred evaluating root project 'mytwayapp'.
> Could not find method implementation() for arguments [project ':app'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
It means that problem is with main build.gradle with dependencies to ":app" but it looks good.
I tried refreshed, rebuild, invalidate, restarted and still have a problem.
Project structure looks strange here is a screen:
ANSWER:
Tips from below are not worked, I downgrade Android Studio from 3.4 to 3.1 and after some cosmetics change it compile. Thanks for your time.
Try to update to latest versions:
dependencies {
classpath 'com.android.tools.build:gradle:x.x.x'
}
And buildToolsVersion in build.gradle
Try change de compileSDkVersion and targetSdkVersion with the same number prefix of buildToolsVersion in app gradle file, like this:
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
// buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.mytway.activity.registerformactivity"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
}
I have an app using Android Annotations and everything is working fine except one thing - you cannot install both flavors on the same device despite the fact that they have different applicationId.
Researching this I came across some problems (that other people had) with annotation processing and flavors, and as I recall this was an issue also here, but we've manage to add following snippet and everything worked.
apt {
arguments {
androidManifestFile variant.outputs[0]?.processResources?.manifestFile
resourcePackageName android.defaultConfig.applicationId
}
}
Until the other day we've didn't notice, that we couldn't install two flavors at once on one device. I've tried changing the gradle but every time I've ended up with the same problem or breaking the gradle script.
As I've mentioned, I've tried all things that I could think of and the online search didn't turn up anything useful, so if anybody have any idea I'll appreciate it.
Following there are my build.gradle scripts.
Top level:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.google.gms:google-services:2.0.0'
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
mavenLocal()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
App module level:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'android-apt'
android {
signingConfigs {
config {
keyAlias 'release'
keyPassword 'keyPassword'
storeFile file('../storeFile.jks')
storePassword 'storePassword'
}
}
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
applicationId "some.awsome.app"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
signingConfig signingConfigs.config
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
testOptions {
unitTests.returnDefaultValues = true
}
productFlavors {
COGNICARE_personal {
applicationId "some.awsome.app.free"
}
COGNICARE_full {
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}
repositories {
flatDir {
dirs 'libs'
}
maven { url "https://jitpack.io" }
mavenCentral()
}
def android_annotations_version = '3.3.2'
def google_libs_version = '23.3.0'
//some lib versions omitted
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
//some aar lib omitted
testCompile 'junit:junit:4.12'
compile "com.android.support:appcompat-v7:$google_libs_version"
apt "org.androidannotations:androidannotations:$android_annotations_version"
compile "org.androidannotations:androidannotations-api:$android_annotations_version"
//some libs omitted
compile 'com.android.support:multidex:1.0.0'
//some libs omitted
}
apt {
arguments {
androidManifestFile variant.outputs[0]?.processResources?.manifestFile
resourcePackageName android.defaultConfig.applicationId
}
}
Thanks in advance for any suggestion. Kudos!
OK, so thanks to #ligi pointing me to the right track.
We have a similar project with a very similar setup and the main difference are the Android Annotation used in one of them, an that has mislead me.
The bottom line is that I've had a provider in the manifest that I wasn't aware of, and the authority conflict did occur at that point.
Thanks for your time. Kudos.
I researched similar questions but none of the answers solved my problem. When I try to build the starter code for a coding assignment I get the following error:
Error: Cause: Peer not authenticated
My gradle files are the following:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.2'
classpath 'com.google.gms:google-services:1.4.0-beta3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.sam_chordas.stockhawk"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.squareup.okhttp:okhttp:2.5.0'
apt 'net.simonvt.schematic:schematic-compiler:0.6.3'
compile 'net.simonvt.schematic:schematic:0.6.3'
compile 'com.melnykov:floatingactionbutton:1.2.0'
compile 'com.android.support:design:23.1.1'
compile('com.github.afollestad.material-dialogs:core:0.8.5.7#aar') {
transitive = true
}
}
I didn't manage any of those files as I don't have gradle experience yet.
Could you help me to figure out what went wrong?
Thank you very much.
P.S.:
The log files give me this error:
2016-03-23 13:01:29,664 [3912009] INFO - .BaseProjectImportErrorHandler - Failed to import Gradle project at '/home/madelenko/Desktop/Stock-Hawk master'
org.gradle.tooling.BuildException: Could not run build action using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.4-all.zip'.
Followed by a gigantic traceback.
I am working on one library project in android. I want to upload my library to the JCenter. I have created bintray account etc & followed all steps which are mentioned here http://inthecheesefactory.com/blog/how-to-upload-library-to-jcenter-maven-central-as-dependency/en
I did below changes in my application module & library module.
Application Module build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.app.testapp"
minSdkVersion 8
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.0'
compile project(':testlib')
}
Library Module build.gradle
apply plugin: 'com.android.library'
ext {
bintrayRepo = 'maven'
bintrayName = 'test-sdk'
publishedGroupId = 'in.test.sdk'
libraryName = 'testlib'
artifact = 'test-sdk'
libraryDescription = 'A wrapper for Facebook Native Like Button (LikeView) on Android'
siteUrl = 'https://github.com/xyz/testsdk'
gitUrl = 'https://github.com/xyz/testsdk.git'
libraryVersion = '1.0.0'
developerId = 'xyz'
developerName = 'xyz'
developerEmail = 'xyz#xyz.xyz'
licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0"]
}
version = "1.0.0"
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 8
targetSdkVersion 22
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// proguardFiles 'proguard-project.txt'
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:22.2.0'
compile files('libs/gson-2.3.1.jar')
compile files('libs/android-query-full.0.26.8.jar')
compile files('libs/httpmime-4.1.1.jar')
compile files('libs/jackson-annotations-2.5.0.jar')
compile files('libs/javax.annotation.jar')
compile files('libs/libGoogleAnalyticsServices.jar')
compile files('libs/okhttp-2.3.0.jar')
compile files('libs/okio-1.3.0.jar')
compile files('libs/retrofit-1.9.0.jar')
}
Project root 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:1.1.3'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'
classpath 'com.github.dcendents:android-maven-plugin:1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
When I am doing this gradlew install then I am getting this error
FAILURE: Build failed with an exception.
* What went wrong:
Task 'install' is ambiguous in root project 'TestApp'. Candidates are: 'installDebug', 'installDebugAndroidTest'.
* Try:
Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 11.685 secs
I spent three days on same but could not get proper solution of it. Please suggest how to resolve it.
Perhaps you forgot to add these lines to the end of your Library Module build.gradle:
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'
You are telling gradle to do the 'install' task but it is telling you that there is no 'install' task and gives suggestions of close task matches like 'installDebug'.
Basically your plugins do not include an install task. If you want to see all the tasks that are available to you run the command below
gradlew tasks --all
Please any one help me.
This is the error: Error:No such property: nexusUsername for class: org.gradle.api.publication.maven.internal.ant.DefaultGroovyMavenDeployer
stacktrace
Information:Gradle tasks [:app:compileDebugJava]
Information:FAILURE: Build failed with an exception.
Information:* What went wrong:
Information:A problem occurred configuring project ':app'.
Information:> A problem occurred configuring project':libraries:HoloColorPicker- master'.
Information: > No such property: nexusUsername for class: org.gradle.api.publication.maven.internal.ant.DefaultGroovyMavenDeployer
Information:* Try:
Information:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Information:0 errors
settings.gradle
include ':app'
include ':libraries:HoloColorPicker-master'
build.gradle
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion '19.0.3'
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:19.+'
compile project(':libraries:HoloColorPicker-master')
}
Holopicker build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
def isReleaseBuild() {
return version.contains("SNAPSHOT") == false
}
allprojects {
version = VERSION_NAME
group = GROUP
repositories {
mavenCentral()
}
}
apply plugin: 'android-library'
android {
compileSdkVersion 19
buildToolsVersion "18.1.1"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
}
}
}
apply from: 'maven_push.gradle'
The HoloColorPicker library has gradle tasks for uploading to the Maven repository that require some properties to be set for the gradle environment (usually in gradle.properties).
The easiest solution would be to remove the line from build.gradle:
apply from: 'maven_push.gradle'
I have not try the solution given by myanimal, but i have try out another thing which works with all the project which have similar issue during importing it. myanimal's solution is related to only one project, and for every project you should have to follow same thing.
But with my solution you might have to do it only once for all future projects.
For my solution do like below:
- create a file ~/.gradle/gradle.properties with the following contents:
nexusUsername=
nexusPassword=
Hope this will help you more for all projects.