build.gradle

Change apk output folder in Gradle 4.1

梦想的初衷 提交于 2019-12-02 20:35:06
I would like to change the APK output folder and this is what I used to do: applicationVariants.all { variant -> variant.outputs.all { def filePath = "${rootProject.rootDir.absolutePath}/apks/${variant.name}" println("My Path: " + filePath) outputFileName = filePath } } However, it didn't work in Gradle 4.1 (Android studio 3.0 preview). Instead of generating the folder as the path above, it generated the above path inside old debug folder like image below: Does anyone have a solution for this? Thanks. This is a workaround to keep the output path same after upgrade to gradle 4.x.

Unable to build gradle and create java class

风流意气都作罢 提交于 2019-12-02 18:01:22
问题 Any project in my android studio fails to build.The error message is as follows- Gradle sync failed: Could not run build action using Gradle distribution 'https://services.gradle.org/distributions/gradle-3.3-all.zip'. Consult IDE log for more details (Help | Show Log) Moreover i'm unable to make a new java class in android studio by File->new->Java class as no such option is available. I found some answers saying right click on java folder then clicking Mark Directory as -> SOurce root, even

Override resources with gradle depending on buildType

*爱你&永不变心* 提交于 2019-12-02 16:42:37
I want to override some strings in my res/strings.xml with gradle. I know that since Android Gradle Plugin 0.7.+ theres the possibilty to have a variant specific source folder. But my app has a lot of flavors and I don't want to add additionally variant specific folders. UPDATE 2014-01-17 What I want in detail: I have some variables in my Resources that are depending only by the buildType (e.g. "release"). First I thought my SOLUTION_1 (override data after resources were merged) is nice, because if I have to change these variables I just have to change them in the build.config (just one place)

error: package android.support.design.widget does not exist

旧时模样 提交于 2019-12-02 16:19:21
问题 i'm new to android. when i want to import a project into my android studio it complain about this error that : error package android.support.design.widget does not exist here is my code : public class CatalogActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_catalog); // Setup FAB to open EditorActivity FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);

What is the syntax for writing comments in build.gradle file?

跟風遠走 提交于 2019-12-02 15:40:54
Looking down this build.gradle file apply plugin: 'com.android.application' android { compileSdkVersion 21 buildToolsVersion "21.1.2" defaultConfig { applicationId "package.myapp" minSdkVersion 19 targetSdkVersion 21 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.nineoldandroids:library:2.4.0' } What if I would like to write a comment on why did I chose this library for this project , what is the

transformClassesAndResourcesWithProguardForRelease FAILED

孤街醉人 提交于 2019-12-02 14:34:56
I am trying to Build my Android application with Gradle in console. But getting below error about task ':app:transformClassesAndResourcesWithProguardForRelease': build.gradle: buildscript { repositories { jcenter() maven { url "https://jitpack.io" } } dependencies { classpath 'com.android.tools.build:gradle:2.2.3' classpath 'com.google.gms:google-services:3.0.0' } } allprojects { repositories { jcenter() maven { url "https://jitpack.io" } } } task clean(type: Delete) { delete rootProject.buildDir } app/build.gradle apply plugin: 'com.android.application' android { compileSdkVersion 24

Install / upgrade gradle on Mac OS X

笑着哭i 提交于 2019-12-02 14:07:19
How do I install/upgrade gradle for Mac? mllm As mentioned in this tutorial , it's as simple as: To install brew install gradle To upgrade brew upgrade gradle (using Homebrew of course) Also see (finally) updated docs . Cheers :)! I had downloaded it from http://gradle.org/gradle-download/ . I use Homebrew , but I missed installing gradle using it. To save some MBs by downloading it over again using Homebrew, I symlinked the gradle binary from the downloaded (and extracted) zip archive in the /usr/local/bin/ . This is the same place where Homebrew symlinks all other binaries. cd /usr/local/bin

Gradle Project Sync failed in Android Studio 2.3.1

青春壹個敷衍的年華 提交于 2019-12-02 13:59:19
Upon reopening Android Studio after an improper shutdown, my gradle project sync failed and many errors like: "Failed to resolve: junit:junit:4.12" started showing up in the Event Log. Screenshot is given below. I tried the following things to no avail: Updated Android Studio to ver 2.3.1 and thus also the Gradle I also had error for "Plugin Error: required plugin "xyz" is disabled" so i deselected all the plugins showing errors from settings and reselected them which removed the error. Then i went to Files -> Invalidate caches/restart What should i do? UPDATE: After clicking on "Disable

Appcompat error with firebase library implementation

放肆的年华 提交于 2019-12-02 13:34:22
Hello I had a little question about adding dependency for firebase. when I add this line: implementation 'com.google.firebase: firebase-core: 17.0.0' to my buil.gradle I see an error line at the line: implementation 'com.android.support:appcompat -v7: 28.0.0 . I searched but not yet a solution. Thank you for helping me. Firebase migrated to AndroidX in the latest release. So no more supports for the old support libraries. You have to either downgrade firebase, implementation 'com.google.firebase:firebase-core:16.0.9' or migrate your app to use AndroidX as mentioned below. This release is a

Android Studio Manifest merger failed minSdkVersion Error

烂漫一生 提交于 2019-12-02 13:11:37
问题 I am trying to add a dependency in my app which has the minimum sdk version newer than my apps so I am getting the following error Error:Execution failed for task ':app:processDebugManifest'. Manifest merger failed : uses-sdk:minSdkVersion 9 cannot be smaller than version 14 declared in library Suggestion: use tools:overrideLibrary="com.nononsenseapps.filepicker" to force usage but I don't know where to add that suggestion so I can build it. This is how my build.gradle(Module: app) looks