0

I have been using Android Studio for a while now and I've decided to switch to Gradle. That caused a whole lot of issues. I managed to get the project to import after some fiddling with the build.gradle file. I am also using 2 libraries for my project(redlaser and ksoap2), that have been messed up. And I'm also trying to add New Relic to my project.

Here is my build file :

buildscript {
repositories {
    mavenCentral()
}
dependencies {
    classpath 'com.android.tools.build:gradle:0.6.+'
  }
  }
    apply plugin: 'android'

dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}

android {
compileSdkVersion 19
buildToolsVersion "18.0.1"

sourceSets {
    main {
        manifest.srcFile 'AndroidManifest.xml'
        java.srcDirs = ['src']
        resources.srcDirs = ['src']
        aidl.srcDirs = ['src']
        renderscript.srcDirs = ['src']
        res.srcDirs = ['res']
        assets.srcDirs = ['assets']
    }

    instrumentTest.setRoot('tests')

    debug.setRoot('build-types/debug')
    release.setRoot('build-types/release')
  }
 }

This works but ofc redlaser won't work with it.

I have searched and searched and I cannot find any good tutorials that walk me through creating a propper build file. Also, merging this https://rpm.newrelic.com/accounts/447602/mobile/2760487/deploy caused issues and won't work.

The redlaser library is redlasersdk.jar/com.ebay.redlasersdk/ (they are already added as libraries, by right-click and add as library) I do NOT have a settings.gradle file. AND if i look at my project's structure in the right panel there is no libraries tab. (but I did manage to access it by clicking on an icon of an error notice on the bottom of the Project Structure tab)

Any help would be appreciated.

Sebek
  • 642
  • 8
  • 22
  • 1
    Migrating to using gradles is horrible. I ended up going back to the using eclipse with the adt bundle. I feel that there's just too much that needs to be fixed in android studio. – BBB Nov 28 '13 at 10:47
  • What do you mean by "2 libraries [..] that have been messed up"? Try to build with gradle commandline and post a error message/log. We migrated to gradle and it works like a charm. It's not too hard to do it. – thaussma Nov 28 '13 at 10:50
  • `redlaser` is jar or apklib dependecy? – Eugen Martynov Nov 28 '13 at 10:53
  • Do you have quite identical folders **debug** and **release**? and Do they contain **lib** folder both? – Eugen Martynov Nov 28 '13 at 10:55
  • Ah I see now that this library has NDK component – Eugen Martynov Nov 28 '13 at 10:56
  • Added **compile files('./libs/redlasersdk.jar/com.ebay.redlasersdk')** to dependencies and got **java.lang.UnsatisfiedLinkError: Couldn't load redlaser from loader dalvik.system.PathClassLoader[dexPath=/data/app/xx.mobile.xx.app-1.apk,libraryPath=/data/app-lib/xx.mobile.xx.app-1]: findLibrary returned null** – Sebek Nov 28 '13 at 12:47

1 Answers1

0

I guess this Including local jar file in project at build time using gradle - issue is your appraoch to go. It provides a way to include jars in your gradle dependencies, but I haven't tested it yet because I am not using Android Studio due to some crash's I had when evaluating it. The Intelij - IDE is pretty perferct but licenced under commercial terms. The direct download from google of the adt - bundle was crashing, too, so I switched to the old school styled Eclipse ADT - approach. Besides: I have made very good experiences with the Zebra Crossing Framework in terms of Barcode - Scanning, which is Open Source.

Community
  • 1
  • 1
Peter
  • 1,769
  • 1
  • 14
  • 18