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'
Related
Basically the problem is I cannot resolve GitHub dependency even though I added this to Project level build.gradle.
build.gradle (Project)
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
and app level build.gradle
dependencies {
implementation 'com.github.mukeshsolanki:country-picker-android:<latest-version>'
How can I fix this? What is this cause possibly? I already updated to the lastest version of Android Studio.
In the string implementation 'com.github.mukeshsolanki:country-picker-android:<latest-version>' at the app level build.gradle file you must replace <latest-version> substring with the actual version of the library. Currently the latest version is 2.0.1.
So the result string should be this: implementation 'com.github.mukeshsolanki:country-picker-android:2.0.1'
I applied to my project Android Architecture Components, by adding this lines to build.gradle:
// Android Architecture Lifecycle
compile "android.arch.lifecycle:runtime:1.0.0-alpha1"
compile "android.arch.lifecycle:extensions:1.0.0-alpha1"
annotationProcessor "android.arch.lifecycle:compiler:1.0.0-alpha1"
// Android Architecture Room
compile "android.arch.persistence.room:runtime:1.0.0-alpha1"
compile "android.arch.persistence.room:rxjava2:1.0.0-alpha1"
annotationProcessor "android.arch.persistence.room:compiler:1.0.0-alpha1"
It worked, but after updating Android Studio to Canary 3 version I'm still getting this error while compiling
Error:org.gradle.api.resources.ResourceException: Could not get
resource
'https://jitpack.io/android/arch/lifecycle/runtime/1.0.0-alpha1/runtime-1.0.0-alpha1.pom'.
Error:org.gradle.api.UncheckedIOException: Could not HEAD
'https://jitpack.io/android/arch/lifecycle/runtime/1.0.0-alpha1/runtime-1.0.0-alpha1.pom'.
Received status code 401 from server: Unauthorized
... other poms from library with the same error.
I tried restarting Android Studio, uninstalling app and of course clean-rebuild.
You need to add the new public Maven repo that Google is using to your build.gradle file.
For example, you could add it to the allprojects closure in the top-level build.gradle file:
allprojects {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
}
Then, all of your modules (e.g., app/) will know to look there in addition to other places for the artifacts.
From your error message, it would appear that Android Studio is only looking in jitpack.io.
compile 'com.github.RogaLabs:social-login:1.2.1'
compile 'com.github.mukeshsolanki:social-login-helper:1.0.2'
compile 'com.github.robertsimoes:Shareable:0.1.0'
compile 'com.github.fccaikai:BottomMenuTutorial:1.0.1'
I tried some other libraries too, they were also giving such type of errors but when I used Glide or Picasso library they synced perfectly.
but getting following error
I am using Gradle version: 2.14.1
At first make sure you add jitpack.io in build.gradle Root level Section .
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
After that Clean-Rebuild and Run .
I want to compile with com.squareup.picasso:picasso:2.5.3-SNAPSHOT. But i got this error:
Error:Could not find com.squareup.picasso:picasso:2.5.3-SNAPSHOT.
Required by:
familywall-android:app:unspecified
Search in build.gradle files
Have someone experienced something similar?
The Picasso snapshot version you mentioned is not available in the standard maven repo. In your build.gradle add the following dependency to your dependencies block:
dependencies {
// 2.5.3 is no longer updated.
compile 'com.squareup.picasso:picasso:3.0.0-SNAPSHOT'
//...
}
and in the repositories block add
repositories {
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
//...
}
I found the .jar here, the last version is 21. It worked!
I'm trying to include Android Asynchronous Http Client and Picasso into my Android project using Gradle. Here's my build.gradle file.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
allprojects {
repositories {
mavenCentral()
}
dependencies {
compile 'com.loopj.android:android-async-http:1.4.4'
compile 'com.squareup.picasso:picasso:2.1.1'
}
}
When I try to sync it, I keep getting the following error.
No signature of method: org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.compile() is applicable for argument types: (java.lang.String) values: [com.loopj.android:android-async-http:1.4.4]
Possible solutions: module(java.lang.Object)
I'm very new to Android so I'm clueless on how to correct this. Can anyone please help me out? I'm using Android Studio version 0.5.8 by the way.
Thank you.
Don't include dependencies in your top-level build file. Include them in module-level build files instead. If you use the Project Structure UI instead of modifying build files directly, it will set things up properly.