简体   繁体   English

库,Gradle和Android Studio

[英]Libraries, Gradle and Android Studio

I have been using Android Studio for a while now and I've decided to switch to Gradle. 我已经使用Android Studio一段时间了,我决定切换到Gradle。 That caused a whole lot of issues. 这引起了很多问题。 I managed to get the project to import after some fiddling with the build.gradle file. 经过一些build.gradle文件的修改后,我设法将项目导入。 I am also using 2 libraries for my project(redlaser and ksoap2), that have been messed up. 我还在我的项目中使用2个库(redlaser和ksoap2),它们已经搞砸了。 And I'm also trying to add New Relic to my project. 而且我还在尝试将New Relic添加到我的项目中。

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. 这可以工作,但是ofc redlaser不能使用。

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. 另外,合并此https://rpm.newrelic.com/accounts/447602/mobile/2760487/deploy会导致问题,并且无法正常工作。

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. redlaser库为redlasersdk.jar / com.ebay.redlasersdk /(通过右键单击并添加为库已将它们添加为库),我没有settings.gradle文件。 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. 任何帮助,将不胜感激。

I guess this Including local jar file in project at build time using gradle - issue is your appraoch to go. 我猜想在构建时使用gradle在项目中包括本地jar文件 -问题是您的解决方法。 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. 它提供了一种在gradle依赖项中包含jar的方法,但是我尚未对其进行测试,因为由于我在评估它时遇到了一些崩溃,因此我没有使用Android Studio。 The Intelij - IDE is pretty perferct but licenced under commercial terms. Intelij-IDE相当不错,但已获得商业条款的许可。 The direct download from google of the adt - bundle was crashing, too, so I switched to the old school styled Eclipse ADT - approach. 从Google直接下载adt-捆绑软件也崩溃了,所以我改用了老式的Eclipse ADT-方法。 Besides: I have made very good experiences with the Zebra Crossing Framework in terms of Barcode - Scanning, which is Open Source. 此外:在开放源代码的条形码-扫描方面,我在Zebra Crossing Framework方面取得了很好的经验。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM