android-gradle

How to set versionName in APK filename using gradle?

梦想与她 提交于 2019-11-26 12:40:44
I'm trying to set a specific version number in the gradle auto-generated APK filename. Now gradle generates myapp-release.apk but I want it to look something like myapp-release-1.0.apk . I have tried renaming options that seems messy. Is there a simple way to do this? buildTypes { release { signingConfig signingConfigs.release applicationVariants.each { variant -> def file = variant.outputFile variant.outputFile = new File(file.parent, file.name.replace(".apk", "-" + defaultConfig.versionName + ".apk")) } } I have tried the code above with no luck. Any suggestions? (using gradle 1.6) I only

Error: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK - Android

十年热恋 提交于 2019-11-26 12:37:57
I know there are lots of questions similiar to this one, but i couldn't find a solution for my problem in any of those. Besides, I'll provide details for my specific case. I coded an Ionic project in Ubuntu 16.04 LTS, and now I have to build it for release. So I run the command: cordova build --release android And I'm shown the following error: Error: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK. Looked here: /home/user/Android/Sdk/tools/templates/gradle/wrapper I don't have this templates/gradle/wrapper directory. My Android Studio is 2.3, the latest

NoClassDefFoundError with Android Studio on Android 4

杀马特。学长 韩版系。学妹 提交于 2019-11-26 12:23:26
I'm in the process of converting an existing app from Eclipse to Android Studio. However, when I run it on a device running 4.x (I've tested several versions on emulators), it immediately crashes with a NoClassDefFoundError . I've tried commenting out references to the classes it can't find, but there's always another. As far as can tell, the offending class is always Within my own code An inner class ( Update: With more investigation, this one isn't always true) Everything works fine on a 5.0.1 emulator (I don't have a device to test on). My build.gradle file is fairly long, but looks like

Execution failed for task ':app:compileDebugAidl': aidl is missing

时间秒杀一切 提交于 2019-11-26 12:19:03
I installed Android Studio on my computer. I created a new project but that got me the error below. What can I do? Error:Execution failed for task ':app:compileDebugAidl'. > aidl is missing My Android Studio version is 1.1.0 . This is my build.gradle file: buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.1.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { jcenter() } } And : apply plugin: 'com.android.application' android { compileSdkVersion

Why are there two build.gradle files in an Android Studio project?

China☆狼群 提交于 2019-11-26 12:14:21
After having imported an Eclipse project into Android Studio, I see two build.gradle files: 1 - <PROJECT_ROOT>\build.gradle 2 - <PROJECT_ROOT>\app\build.gradle The first version is shorter, the second version contains definitions for compileSdkVersion , etc. What is the purpose behind having two separate files? Are there separate build tasks? Gabriele Mariotti <PROJECT_ROOT>\app\build.gradle is specific for app module . <PROJECT_ROOT>\build.gradle is a "Top-level build file" where you can add configuration options common to all sub-projects/modules. If you use another module in your project,

Tools: replace not replacing in Android manifest

别来无恙 提交于 2019-11-26 12:07:34
I am using a gradle project with many different library dependencies and using the new manifest merger. In my <application /> tag I have it set up as such: <application tools:replace="android:icon, android:label, android:theme, android:name" android:name="com.example.myapp.MyApplcation" android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/application_name" android:logo="@drawable/logo_ab" android:theme="@style/AppTheme" > .... </application> Yet I am receiving the error: /android/MyApp/app/src/main/AndroidManifest.xml:29:9 Error: Attribute application@icon

Gradle - What is a non-zero exit value and how do I fix it?

此生再无相见时 提交于 2019-11-26 11:54:04
I am developing an Android application, and every time I run it, I get this message: :module:someTask FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':module:someTask'. > some message here... finished with non-zero exit value X * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. BUILD FAILED Total time: Y.ZZ secs I have already tried cleaning and building the project, but the error persists. I have seen answers that say to enable Multidex or increase the heap size, but I am sure I

Gradle build tool cannot find play-services-tasks.aar? Why?

六眼飞鱼酱① 提交于 2019-11-26 11:53:29
Today suddenly, I got an error when I tried to run my app in Android studio. It is: Error: Could not find play-services-tasks.aar (com.google.android.gms:play-services-tasks:15.0.1). Searched in the following locations: https://jcenter.bintray.com/com/google/android/gms/play-services-tasks/15.0.1/play-services-tasks-15.0.1.aar I didn't change anything in the gradle file but it appeared suddenly. My previous build executed successfully some minutes ago. Why it can't find play-services-tasks.aar which is the part of com.google.android.gms:play-services-tasks:15.0.1 Steps taken: I checked whether

What is real Android Studio Gradle Version?

人盡茶涼 提交于 2019-11-26 11:23:32
I Have a Question. In (Root)build.gradle Gradle Version is 3.1.3 (Root)build.gradle buildscript { repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.1.3' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } In project-structure Gradle Version is 4.4 Project-Structure Gradle version 4.4 In Gradle-wrapper-properties distributionUrl's Gradle Version is 4.4 Gradle-Wrapper-Properties #Tue Jul 17 17:49:20 KST 2018 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists

Error:(6, 0) Gradle DSL method not found: &#39;google()&#39;

不打扰是莪最后的温柔 提交于 2019-11-26 10:24:42
/Users/Ren/Desktop/RecylerViewBaseAdapter/build.gradle Error:(6, 0) Gradle DSL method not found: 'google()' Possible causes: The project 'RecylerViewBaseAdapter' may be using a version of Gradle that does not contain the method. Gradle settings The build file may be missing a Gradle plugin. Apply Gradle plugin The google() repo is a shortcut to looks in Google's Maven repository for dependencies. It was introduced with gradle v.4.0 . It requires (currently) Gradle v.4 Android Studio 3.x. Gradle plugin for Android 3.x Try to use in gradle-wrapper.properties use: distributionUrl=\ https\:/