I'm trying to run a React-Native android app using react-native run-android, but it's stuck at
<=------------> 12% EXECUTING [8m 44s]
:app:preDebugBuild > Resolve dependencies :app:debugRuntimeClasspath > android-job-v1.1.12a-SNAPSHOT.pom
where android-job-v1.1.12a is a branch in my public repo on GitHub. It seems to get stuck only for some of the branches but not all. For instance, master-SNAPSHOT is fine.
The repositories and dependencies sections of my build.gradle looks like this:
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
dependencies {
compile 'com.facebook.react:react-native:+'
implementation 'com.github.myuser:android-job:v1.1.12a-SNAPSHOT'
}
Does anyone know why it gets stuck?
EDIT:
I'm using gradle 4.1.
hmm what gradle version are you using? have you tried to replace compile with implementation (for 3.x gradle) and implementation with compile (for 2.x gradle)
I've found out it was jitpack not building the branch correctly.
I added the following line to my build.gradle(Module:app):
compile 'com.android.support:design:25.4.0'
But when executing Gradle I'm getting
Failed to resolve: com.android.support.design:25.4.0
I got that the support code from the android support design library and added it to a new project. I added it to the dependency section as such:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:25.4.0'
}
Any ideas on what I'm doing wrong?
Important: The support libraries are now available through Google's Maven repository. You do not need to download the support
repository from the SDK Manager. For more information, see Support
Library Setup.
Step 1: Open the build.gradle file for your application.
Step 2: Make sure that the repositories section includes a maven section with the "https://maven.google.com" endpoint. For example:
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
Step 3: Add the support library to the dependencies section. For example, to add the v4 core-utils library, add the following lines:
dependencies {
...
compile "com.android.support:support-core-utils:25.4.0"
}
A more updated version of the answer of "Bhavesh Patadiya" :
In your project build.gradle file, add google() into the repositories blocks:
repositories {
jcenter()
google()
}
Update the same file with a newer Gradle version:
classpath 'com.android.tools.build:gradle:2.3.3'
If the above cause you new issues or the same issue, exit Android-Studio, and delete the "gradle" folder/s (maybe also ".gradle" folder) and the "build" folder and sub-folders, and then open Android-Studio again.
Mr. Bhavesh Patadiya give us a good solution. However, I'd like to share something more, to make fix process more explicit.
There are two "build.gradle" files under the project directory. Their pathes are to be "Your-project-root-dir/build.gradle" and "Your-project-root-dir/app/build.gradle" respectively. When you see the error information in your android studio, and try to trace the file, you will probably open the second one.
You should add this statement in the first file ("Your-project-root-dir/build.gradle").
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
and add the statements in the second build.gradle ("Your-project-root-dir/app/build.gradle")
dependencies {
...
compile "com.android.support:support-core-utils:27.0.2"
}
Always keep appcompact version and support lib versionssame, so change com.android.support:design:25.4.0 to com.android.support:design:25.3.1
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}
You need to update the android support Repository in the SDK manager . Also the Design Library depends on the Support v4 and AppCompat Support Libraries.
Same version android support must be the same with others..
compile 'com.android.support:appcompat-v7:25.3.1' <-- same
compile 'com.android.support:design:23.3.1' <-- same
after adding :
maven {
url "https://maven.google.com"
}
make sure your Gradle sync is on ONLINE mode
you can check it from:
Android studio -> Preferences -> Build, Execution, Deployment ->
Gradle -> Offline work (make sure this check box is not selected)
This problem occurs when there is andoridtestImplementation is added in app.build.
Remove testImplementation,androidTestImplementation from the app.build, that solves this issue.
Above answers did't resolve anything for me.
Tried syncing the project- Failed.
Tried building the project -Failed
Problem found :
Sdk Support Repository was corrupted
.
Fix:
Go to the SDK manager, click the "SDK Tools" tab. If the check-mark
for "Support Repository" is selected, unselect it and click OK. This
will delete all of the files in the repository. Then recheck the
check-mark, click GO and reinstall the repository.
If you still have the issue, check the project settings for offline mode. if offline mode is on, then off and sync the project. That fixed my issue.
There is no library by that name. There is com.android.support:recyclerview-v7:25.4.0.
Failed to resolve com.android.support:support-compat:25.4.0
Failed to resolve com.android.support:support-core-ui:25.4.0
I am trying to include this library to my project by adding
compile 'jp.wasabeef:recyclerview-animators:2.2.7'
so remove this line from gradle
my error just resolved
I am fairly new to Android programming and am trying to use the libsodium-jni library for some basic Crypto tasks. In Android Studio I add libsodium-jni-aar as a Library Dependency and I can see that this modifies my build.gradle file by adding :
compile 'com.github.joshjdevl.libsodiumjni:libsodium-jni-aar:1.0.6'
Many of the functions in this library work fine, but when I use the Sodium.sodium_init() function I get
java.lang.UnsatisfiedLinkError: No implementation found for int org.libsodium.jni.SodiumJNI.sodium_init() (tried Java_org_libsodium_jni_SodiumJNI_sodium_1init and Java_org_libsodium_jni_SodiumJNI_sodium_1init__)
at org.libsodium.jni.SodiumJNI.sodium_init(Native Method)
I'm guessing somehow this is caused by the fact that sodium_init is a native function and for some reason the implementation is not being installed to the phone (or emulator) by gradle.
Any help would be greatly appreciated.
To import a Sonatype repository you need to add this
maven {
url "https://oss.sonatype.org/content/repositories/snapshots/"
}
to your project build.gradle file in the allprojects object which should result in something similar to this:
allprojects {
repositories {
jcenter()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
}
}
Then you can add your compile statement in your app build.gradle file
compile 'com.github.joshjdevl.libsodiumjni:libsodium-jni-aar:1.0.7-SNAPSHOT'
I had dagger included in build.gradle (app) as follows:
{compile 'com.squareup.dagger:dagger:1.2.+'
provided 'com.squareup.dagger:dagger-compiler:1.2.+'}
Now I am trying to upgrade my project to Dagger 2.0 and create unit test with Mockito and Espresso, my new dependency consists of:
compile 'com.google.dagger:dagger:2.0-SNAPSHOT'
apt 'com.google.dagger:dagger-compiler:2.0-SNAPSHOT'
provided 'org.glassfish:javax.annotation:10.0-b28'
I have Facebook SDK included in the project included in the project and I am getting error as error: cannot find symbol class R
I also have added as repository maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
I would appreciate any help understanding what is going on here and how to resolve it.
Add this to the Project build.gradle as a dependency{}
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
and add this to the module build.gradle
apply plugin: 'com.neenbedankt.android-apt'
View https://oss.sonatype.org/content/repositories/snapshots/com/google/dagger/dagger-compiler/2.1-SNAPSHOT/
there is no 2.0-SNAPSHOT version. Just change your 2.0-SNAPSHOT to 2.1-SNAPSHOT. It helps to me in same case.
My Android app is based on Gradle and it just takes ages to build every time. This is due to the number of modules I have. Even if there are no changes in submodules, it keeps rebuilding every sources.
I was wondering if there is any way to convert these modules to local snapshot dependencies as I'm not updating them often?
I'm pretty sure it's possible but I have a very basic experience with gradle and maven so I can't figure out a simple way to do that.
Basically right now I'm listing my dependencies like that:
dependencies {
compile project(':Library:lib1')
compile project(':Library:lib2')
compile project(':Library:lib3')
}
and I'd like to use something like that:
repositories {
local()
}
dependencies {
compile 'com.lib1:lib:SNAPSHOT-1.0')
compile 'com.lib2:lib:SNAPSHOT-1.0')
compile 'com.lib3:lib:SNAPSHOT-1.0')
}
To use local snapshots use the maven-publish plugin. If you use SNAPSHOT in the version (e.g. 0.0.1-SNAPSHOT) you will publish snapshots to your local repository. For the build.gradle for lib1 you should do something like this:
apply plugin: 'java'
apply plugin: 'maven-publish'
project.version=0.0.1-SNAPSHOT
publishing {
publications {
maven(MavenPublication) {
from components.java
}
}
}
and run the :publishMavenPublicationToMavenLocal target.
In you gradle build file for projects using the library use:
repositories {
local()
}
dependencies {
compile group: 'com.lib1', name: 'lib', version: 'SNAPSHOT-0.0.1', changing: true
}
The 'changing' attribute indicates that not a cached version is used (normally updated once every 24hrs) but always checks for the latest.