build.gradle

How to set buildConfigField parameters dynamically while building an apk through Jenkins

孤者浪人 提交于 2019-12-03 22:06:32
问题 I have following fields in ProductFlavors of build.gradle, productFlavors { Flavor1 { applicationId "com.example.A" buildConfigField 'int', 'ID', '123' } } How can i update these 2 fields according to inputs given from Jenkins.? Thanks in advance!! 回答1: You can use following steps: In your app level build.gradle: buildscript { ext{ appId="com.example.A" Id=123 } ... } change your fields as follows: productFlavors { Flavor1 { applicationId appId buildConfigField 'int', 'ID', "$Id" } } From

Gradle Build Failure

佐手、 提交于 2019-12-03 20:33:46
问题 My project compiles and executes well on debug mode but when i try to generate a signed apk, errors arise. This appears on the message log: :app:proguardRelease Warning:android.support.v4.app.DialogFragment: can't find referenced class android.support.v4.app.DialogFragment$DialogStyle Warning:android.support.v4.app.FragmentTransaction: can't find referenced class android.support.v4.app.FragmentTransaction$Transit Warning:android.support.v4.view.ViewCompat: can't find referenced class android

Android linker: undefined reference to bsd_signal

天大地大妈咪最大 提交于 2019-12-03 19:15:32
问题 I'm running gradlew to compile an Android app that has a static lib dependency. Somehow, I have an undefined reference to bsd_signal . I was able to compile this app with gradle 1.X, but I've been obliged to switch to gradle 2.10 and to drop my Android.mk file in favour of putting more build instruction into my gradle.build file, and this is where the trouble arises. Can anyone tell me whether there is a library that defines bsd_signal , which I should link to my project? Compiler output

Gradle build error, Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'

对着背影说爱祢 提交于 2019-12-03 18:40:10
问题 I've updated the Android studio for 1.4, also gradle version updated(1.4.0-beta3). It is my build.gradle file // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() } dependencies { //classpath 'com.android.tools.build:gradle:1.2.3' classpath 'com.android.tools.build:gradle:1.4.0-beta3' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } }

How to run JUnit tests with Gradle?

那年仲夏 提交于 2019-12-03 18:24:21
问题 Currently I have the following build.gradle file: apply plugin: 'java' sourceSets { main { java { srcDir 'src/model' } } } dependencies { compile files('libs/mnist-tools.jar', 'libs/gson-2.2.4.jar') runtime fileTree(dir: 'libs', include: '*.jar') } This build.gradle file is for my repository here. All of my main files are in src/model/ and their respective tests are in test/model . How do I add a JUnit 4 dependency correctly and then run those tests in the folders of tests/model ? 回答1: How do

How to use Oracle JDBC driver in Gradle project

佐手、 提交于 2019-12-03 17:58:52
问题 I'm new with Gradle projects and I have one question. I've searched in Internet but I couldn't find what I need or maybe I couldn't know how to search it. First I'm going to tell you my case. I have a Gradle project and I would like to execute several automated tests, in the future with jenkins, but now I want to try on Eclipse. I have the oracle jdbc driver in /lib directory, and this is my build.gradle apply plugin: 'java' // In this section you declare where to find the dependencies of

Add productFlavor to experimental Android gradle plugin library

末鹿安然 提交于 2019-12-03 17:28:44
问题 I've got a project that uses the experimental gradle plugin, i.e. 0.2.0 . When I've got no productFlavor , I can perfectly integrate a library module in Android Studio and everything works perfectly. But when the library has a productFlavor , I main project doesn't find the library classes. This fix does not appear to work with the experimental gradle plugin. Does anyone have any idea how make flavors work with the new plugin? Library: android.productFlavor { create ('flavor') { ... } }

Could not find com.android.support:support-v4:22.0.0. after SDK update

不羁岁月 提交于 2019-12-03 17:26:30
问题 After the sdk update im not able to create a hello world application. My build.gradle looks like this apply plugin: 'com.android.application' android { compileSdkVersion 22 buildToolsVersion "22.0.1" defaultConfig { applicationId "com.coders.yo" minSdkVersion 11 targetSdkVersion 22 versionCode 1 versionName "1.0" } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs',

Android Library project can't import R class of another library project when using gradle to compile on command line

萝らか妹 提交于 2019-12-03 15:38:11
I have this structure for my android project: ProjectDir settings.gradle MyApp(depends on LibraryA and LibraryB) -->build.gradle -->All the other android code LibraryA (depends on LibraryB) -->build.gradle -->All the other android code LibraryB (Has lots of resources that are used in LibraryA and MyApp) -->build.gradle -->All the other android code I can compile the android app just fine using both eclipse and Android Studio. LibraryA imports the R file of LibraryB by doing " import com.LibraryB.R; " I also make use of com.LibraryB.R.layout.... type references in code and as long as I'm in the

I have to add .aar files as a library in a sub project in Android studio. It gives me an error.

你说的曾经没有我的故事 提交于 2019-12-03 15:32:51
I have added the .aar files to libs folder in the sub-project. And have given the repositories as: repositories { mavenCentral() mavenLocal() flatDir { dirs 'libs' } in the build.gradle of this sub-project. Do I need to add dependencies in Main project's build.gradle also? If yes, how should that be done? classpath 'com.android.tools.build:gradle:1.3.0' File -> New Module -> Import JAR/AAR Package "File name" select .aar file, example: d:/myproject/mylib/build/outputs/aar/mylib-release.aar "Subproject name",example: mylib-release /app/build.gradle dependencies{ compile fileTree(include: ['*