I'm debugging stuff on a lib and was trying to integrate crashlytics on it. At first, I've followed this, and after some problems, managed to build the library without errors.
The thing is: when I try to use Fabric.with(this, new Crashlytics(), new CrashlyticsNdk()) in the app which uses that lib, it gives me an "symbol cannot be resolved".
I've tried moving this line into the lib, but all I've got was a NoClassDefFoundError.
Any suggestions?
Below, my lib gradle
apply plugin: 'com.android.library'
android {
compileSdkVersion 20
buildToolsVersion '20'
defaultConfig {
minSdkVersion 9
targetSdkVersion 9
versionCode 1
versionName "1.0"
}
buildTypes {
release {
}
}
productFlavors {
}
}
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/mylib.jar')
compile('com.crashlytics.sdk.android:crashlytics:2.5.2#aar') {
transitive = true;
}
compile('com.crashlytics.sdk.android:crashlytics-ndk:1.1.0#aar') {
transitive = true
}
}
and my app gradle:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 20
buildToolsVersion '20'
defaultConfig {
applicationId 'com.test.app'
minSdkVersion 15
targetSdkVersion 20
versionCode 1
versionName '1.0'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
packagingOptions {
exclude 'LICENSE.txt'
}
sourceSets {
androidTest.setRoot('src/test')
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt')
}
}
productFlavors {
}
splits {
abi {
enable true
reset()
include 'armeabi'
}
}
}
repositories {
flatDir { dirs 'libs' }
}
dependencies {
compile(name: 'my-framework', ext: 'aar')
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.0'
androidTestCompile 'com.android.support.test:testing-support-lib:0.1'
}
Related
here's my gradle file
I am getting this error
Error:(22, 0) Could not find method android() for arguments
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
android {
defaultConfig {
minSdkVersion 26
targetSdkVersion 26
}
productFlavors {
}
}
dependencies {
}
You need to apply a plugin to your build.gradle file. Only then you will be able to use the android block. Add any of these two lines at the top of your build.gradle file:
Application : apply plugin: 'com.android.application'
Library : apply plugin: 'com.android.library'
Your App Gradle should look like something like this
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.armenhovhannisyan.backpaper.backpaper"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.0.0-beta1'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:design:26.0.0-beta1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
}
I'm already facing this error:
"Failed to
resolve:com.github.ygorbarboza:AKParallax-Android:fce9eac521"
"Showing error :Gradle DSL method not found:'maven()' "
Here's my build.gradle file.
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.abhishek.experiment"
minSdkVersion 11
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.aar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.github.ygorbarboza:AKParallax-Android:fce9eac521'
}
I have even added the repository
repositories {
maven {
url "https://jitpack.io"
}
}
You need to add
repositories {
maven {
url "https://jitpack.io"
}
}
as mentioned here
My gradle seems to be complaining that it Could not find any version that matches com.google.maps.android:android-maps-utils:+.
Gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.11.+'
}
}
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion '19.1.0'
lintOptions {
abortOnError false
}
defaultConfig {
minSdkVersion 11
targetSdkVersion 19
}
signingConfigs {
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
productFlavors {
}
}
dependencies {
compile 'com.google.android.gms:play-services:4.+'
compile 'com.android.support:support-v4:19.1.+'
compile 'com.google.maps.android:android-maps-utils:+'
compile project(':libraries:facebook')
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile files('libs/libGoogleAnalyticsServices.jar')
compile files('libs/svg-android.jar')
}
you havn't declared a repository for your project, just for the buildscript stuff.
try adding a first level repository block
repositories {
jcenter()
}
I'm using Robospock to perform unit testing and mocking with gradle. This worked great until I added gradle build variants to the mix.
My android build.gradle file:
apply plugin: 'android-library'
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
defaultConfig {
minSdkVersion 16
targetSdkVersion 19
versionCode 1
versionName "0.0.1"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
productFlavors {
uat {
packageName "com.acme.dev"
}
stage {
packageName "com.acme.staging"
}
prod {
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.mcxiaoke.volley:library:1.0.4'
}
My robospock build.gradle file:
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.8.+'
classpath 'org.robospock:robospock-plugin:0.4.0'
}
}
repositories {
mavenCentral()
}
apply plugin: 'groovy'
dependencies {
compile "org.codehaus.groovy:groovy-all:1.8.6"
compile 'org.robospock:robospock:0.4.4'
compile 'cglib:cglib-nodep:2.2'
compile 'org.objenesis:objenesis:1.3'
}
project.ext {
robospock = ":Mothership" // project to test
}
apply plugin: 'robospock'
The Android gradle plug-in offers me build variant tasks such as assembleProd, assembleProdDebug, assembleStageDebugTest. Can I pass something to Robospocl in my build.gradle so that it can participate in the build variants?
Currently when I execute ./gradlew robospok, it cannot find the classes defined in com.acme.dev or com.acme.staging
I'm trying to add both Showcaseview by amlcurran and Android-DirectoryChooser by passy to my android app from MavenCentral, but I keep getting this error for both libraries:
Error:net.rdrei.android.dirchooser:library:2.0
This is my Project Gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
allprojects {
repositories {
mavenCentral()
}
}
This is the inner one:
apply plugin: 'android'
android {
lintOptions {
checkReleaseBuilds false
}
compileSdkVersion 19
buildToolsVersion "19.0.3"
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
versionCode 6
versionName "1.2.2"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0#aar'
compile 'org.jaudiotagger:jaudiotagger:2.0.1#jar'
compile 'com.android.support:support-v4:19.1.0'
compile 'net.rdrei.android.dirchooser:library:2.0#aar'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
How can I fix it?
The problem is that you are not specifying the repository URL. Check my answer here:
https://stackoverflow.com/a/23879736/570612