Install-missing-android-tools fails with "Could not find common.jar (android.arch.core:common:1.1.0)."

Bitrise Build Issue Report template

Description of the issue

Our Android builds recently started failing early on when it’s trying to install the Android tools.

Here’s the error for the step:

+------------------------------------------------------------------------------+

| (2) install-missing-android-tools                                            |
+------------------------------------------------------------------------------+
| id: install-missing-android-tools                                            |
| version: 2.2.0                                                               |
| collection: https://github.com/bitrise-io/bitrise-steplib.git                |
| toolkit: go                                                                  |
| time: 2018-06-07T16:42:18Z                                                   |
+------------------------------------------------------------------------------+
|                                                                              |
INFO[16:42:18] Start installing (golang) with apt-get       
INFO[16:42:18]  * [OK] Step dependency (go) installed, available. 
Configs:
- GradlewPath: android/gradlew
- AndroidHome: /opt/android-sdk-linux
Preparation
Set executable permission for gradlew
Initialize Android SDK
Ensure android licences
Ensure required Android SDK components
Retrying...
Failed to ensure android components, error: output: To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/2.14.1/userguide/gradle_daemon.html.
Incremental java compilation is an incubating feature.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not find common.jar (android.arch.core:common:1.1.0).
  Searched in the following locations:
      https://jcenter.bintray.com/android/arch/core/common/1.1.0/common-1.1.0.jar
* Try:
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.16 secs
error: exit status 1
|                                                                              |
+---+---------------------------------------------------------------+----------+
| x | install-missing-android-tools (exit code: 1)                  | 300 sec  |
+---+---------------------------------------------------------------+----------+
| Issue tracker: ...bitrise-steplib/steps-install-missing-android-tools/issues |
| Source: ...://github.com/bitrise-steplib/steps-install-missing-android-tools |
+---+---------------------------------------------------------------+----------+

Note that the .jar is not found here: https://jcenter.bintray.com/android/arch/core/common/1.1.0/

However, the .jar is found here: https://jcenter.bintray.com/android/arch/core/common/1.1.1/

Environment:

Where did the issue happen?

Android & Docker, on Ubuntu 16.04
Step: install-missing-android-tools

Reproducibility

  • Does a “Rebuild” help? (You can trigger a rebuild from the Build’s page, by clicking the “Rebuild” button in the top right corner of a finished build) : NO
  • Does a rebuild without caches help? (You can remove the Cache:Pull and Cache:Push steps temporarily to not to use the cache, or you can delete all the caches on the Settings tab of the app. : NO
  • Does the issue happen sporadically, or every time? : Every time
  • Does upgrading the build Step to the latest version help? : NO
  • When did the issue start? : Today, June 7th

Local reproduction: Linux / Android (docker based) stack builds

I admit I have not tried this.

Build log

I was having the same issue. I moved my google() repository above jcenter() in my build.gradle files and it fixed the issue.

Thanks for the reply! Like this?

repositories {
    maven {
        url 'https://maven.google.com/'
        name 'Google'
    }
    jcenter()
}

It didn’t work for me. :frowning:

Update: I had to reorder it in both buildscript and allprojects, and now it works. Thanks again @rlepinski!

Sorry if this is a silly question, but how do you modify build.gradle in bitrise? I am using Ionic, so it builds it automatically.

@sugiserv I Fixed the issue by using the hook script below

#!/usr/bin/env node

var fs = require('fs');
var path = require('path');
var rootdir = process.argv[2];
var gradleFile = path.join(rootdir, "platforms/android/build.gradle");

fs.readFile(gradleFile, "utf8", function (err, data) {
  if (err)
    return console.log(err);

  var result
  result = data.replace(/repositories[^}]+\s*\}\s*\}/g, "repositories {\r\nmaven {url \"https://maven.google.com\"}\r\njcenter()\r\n}");

  fs.writeFile(gradleFile, result, "utf8", function (err) {
    if (err)
      return console.log(err);
  });
});

Hi @l9c
Where should I put this script?

ps: i use Ionic Archive

YOUR_PROJECT/hooks/after_prepare

puttin maven before jcenter does enable my project to build, but causes telerik-verified-imagepicker crashes at runtime.
Is there another solution?

@robgore that seems to be an unrelated issue, if you need help with that I’d suggest you to create a new #issues:build-issues report so that it gets visibility and tracking :wink:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.