Consider the build.gradle below:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.0.0-b9'
}
}
apply plugin: 'org.javafxports.jfxmobile'
repositories {
jcenter()
}
mainClassName = 'com.rameses.Main'
jfxmobile {
android {
manifest = 'src/android/AndroidManifest.xml'
}
ios {
infoPList = file('src/ios/Default-Info.plist')
}
}
And I want to add a new dependency
dependencies {
compile files('libs/custom.jar')
}
QUESTION : How to merge two dependencies together? I tried something like the code below but it didn't worked, it throws an error. Any Idea?
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.0.0-b9',
compile files('libs/custom.jar')
}
Add a separate dependencies block to the build gradle like this -
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.0.0-b9'
}
}
apply plugin: 'org.javafxports.jfxmobile'
repositories {
jcenter()
}
mainClassName = 'com.rameses.Main'
jfxmobile {
android {
manifest = 'src/android/AndroidManifest.xml'
}
ios {
infoPList = file('src/ios/Default-Info.plist')
}
}
dependencies {
compile files('libs/custom.jar')
//other dependencies - go here
}
Related
I've programmed an android library which uses the org.web3j:core:4.6.0-android dependency. Now I've exported my library as a .aar and imported as a new module into a android application. I can build and run the application but as soon as a function uses the web3j:httpClient it throw the exception: NoClassDefFoundError for web3j.httpClient...
How can I solve this issue?
This is my build-gradle of my application, the example_sdk part is my android library using web3j:
group 'io.test.test_plugin'
version '1.0'
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
}
}
rootProject.allprojects {
repositories {
google()
jcenter()
flatDir {
dirs 'java/libs'
}
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 29
defaultConfig {
minSdkVersion 19
}
lintOptions {
disable 'InvalidPackage'
}
}
dependencies {
implementation project(path: ':example-sdk')
implementation "androidx.core:core-ktx:+"
}
repositories {
mavenCentral()
}
I have JFrog Open Source installed on a server and upload an android aar library by hand.
In the gradle file, I set up a configuration like this.
buildscript {
dependencies { classpath "org.jfrog.buildinfo:build-info-extractor-gradle:latest.release" }
repositories {
maven {
credentials {
username = artifactory_username
password = artifactory_password
}
url "https://.../artifactory/libs-release"
}
}
}
allprojects{
apply plugin: org.jfrog.gradle.plugin.artifactory.ArtifactoryPlugin
artifactory {
resolve {
contextUrl = "https://.../artifactory"
repoKey = 'libs-global'
username = artifactory_username
password = artifactory_password
}
}
}
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:latest.release"
}
}
apply plugin: "com.jfrog.artifactory"
QUESTION:
How can download or implement my aar libary in the android project?
Example:
implementation 'com.google.code.gson:gson:2.8.6'
You need to add your Jfrog in build.gradle(project) like this:
allprojects {
repositories {
...
maven {
url("https://your-url.jfrog.com/more/path")
}
google()
jcenter()
...
}
}
Then you just add your dependency in dependencies.
Here's my error:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
Could not find com.google.android.gms:play-services-base:x.y.z.
Searched in the following locations:
file:/Users/arronlinton/Library/Android/sdk/extras/m2repository/com/google/android/gms/play-services-base/x.y.z/play-services-base-x.y.z.pom
Going off of what it's saying it can't find, is that suggesting I need to install something locally and/or perhaps via Android SDK Manager?
Or would this require me to edit my build.gradle?
Need any additional information?
-
build.gradle
buildscript {
ext {
buildToolsVersion = "28.0.2"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 27
supportLibVersion = "28.0.0"
googlePlayServicesVersion = "15.0.1"
androidMapsUtilsVersion = "0.5+"
}
repositories {
google()
jcenter()
mavenLocal()
// mavenCentral()
maven {
url 'https://maven.fabric.io/public'
// name 'Google'
}
maven {
url 'http://artifactory.raksdtd.com/artifactory/libs-release'
}
maven { url 'https://dl.bintray.com/android/android-tools' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.google.gms:google-services:4.2.0'
classpath 'io.fabric.tools:gradle:1.26.1'
// classpath 'com.google.firebase:firebase-plugins:1.1.5'
}
}
allprojects {
repositories {
google()
jcenter { url "http://jcenter.bintray.com/"}
maven { url "https://maven.fabric.io/public" }
configurations.all {
resolutionStrategy {
force "com.google.android.gms:play-services-basement:$googlePlayServicesVersion"
force "com.google.android.gms:play-services-tasks:$googlePlayServicesVersion"
}
}
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.google.android.gms'
&& !details.requested.name.contains('multidex')) {
details.useVersion "x.y.z"
}
}
}
}
}
}
Change dependency declaration as follows
from
compile
to
implementation
Also check in our root gradle file contains jcenter and maven repo like as follows
buildscript {
repositories {
maven {
url 'http://artifactory.raksdtd.com/artifactory/libs-release'
}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
build.gradle(Project:)
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile('com.magnet.mmx:magnet-mmx-client-android:1.9.1#aar') {
transitive = true
}
unable to resolve com.magnet.mmx:magnet-mmx-client-android:1.9.1 from build.gradle
build.gradle(Module:)
buildscript {
repositories {
jcenter{
url "http://jcenter.bintray.com/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter{
url "http://jcenter.bintray.com/"
}
mavenLocal()
maven {
url "https://repo.magnet.com/artifactory/public"
}
}
}
In your app's build.gradle, use this,
repositories {
maven {
url "http://repo.magnet.com:8081/artifactory/public/"
}
mavenLocal()
mavenCentral()
}
dependencies {
compile('com.magnet.mmx:magnet-mmx-client-android:1.9.1#aar') {
transitive = true
}
}
You can also find the dependency in this URL,
http://repo.magnet.com/artifactory/public/com/magnet/mmx/magnet-mmx-client-android/1.9.1/
In my application (MyApp), I am using an another project(Appox) as library and in this (Appox) project, I want to include bugsense-jar from their repository. Now in build.gradle of Appox, I am including it in this way
apply plugin: 'android-library'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
}
}
repositories {
mavenCentral()
maven { url 'http://www.bugsense.com/gradle/' }
}
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile 'com.bugsense.trace:bugsense:3.6'
}
android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
sourceSets {
main {
//....
}
}
}
But on compiling I am always getting the error Failed to find com.bugsense.trace:bugsense:3.6
Am I including it in the correct way? Is it possible that the file is not even present in their repo?
Just to bring this up to date, Bugsense has been renamed Mint, so the references to the bugsense.com repo are broken. So, update your Gradle file with the following:
apply plugin: 'android'
repositories {
maven { url "https://mint.splunk.com/gradle/" }
}
dependencies {
compile "com.splunk.mint:mint:4.3.0"
}
From: http://docs.splunk.com/Documentation/MintAndroidSDK/latest/DevGuide/Requirementsandinstallation
If you're updating old code, you'll also need to update your imports and rename any instances of BugSenseHandler in your code to Mint. (http://docs.splunk.com/Documentation/MintAndroidSDK/latest/DevGuide/AddSplunkMINTtoyourproject)
Try something like this :
apply plugin: 'android-library'
buildscript {
repositories {
maven { url 'http://www.bugsense.com/gradle/' }
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
compile 'com.bugsense.trace:bugsense:3.6'
}
android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
sourceSets {
main {
....
}
}
}
Changes made :
All Maven repositories declared at the same time
mavenCentral() is declared in the last position
Sources :
http://blog.bugsense.com/post/58900337206/gradle-repository-is-now-available-for-bugsense
http://gradleproject.wordpress.com/2013/02/14/multiple-maven-repositories-in-gradle/