android-gradle

Build flavors for different version of same class

半城伤御伤魂 提交于 2019-11-27 06:43:23
I've got a project, structured like this: project/ | |---src/ |---flavorA2/ | | | |---java/ | | |---com.abc.flavorA.mk2 | | |-----classA.java | | |-----classB.java | |---res/ | |---AndroidManifest.xml | |---main | |---java/ | | |---com.abc.flavorA | | |-----classA.java | | |-----classB.java | | |-----classC.java | | |-----classD.java | |---res/ | | |---drawable/ | | |---layout/ | | |---values/ | | | |---AndroidManifest.xml | |---flavorA flavorA will use the source and assets from main completely while flavorA2 has some small changes in classA and classB and the package name is also changed to

Android Studio and Gradle build error

守給你的承諾、 提交于 2019-11-27 06:28:53
I've been using the new preview of android studio and really like it. But recently my project won't build. I get the following error: Gradle: FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':TestProj:compileDebug'. > Compilation failed; see the compiler error output for details. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Could not execute build using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'. Question is how do I enable the stack trace so I

How to generate buildConfigField with String type

你。 提交于 2019-11-27 06:28:16
In my Android Studio project there are two build configuration with some buildConfigField : buildTypes { def SERVER_URL = "SERVER_URL" def APP_VERSION = "APP_VERSION" debug { buildConfigField "String", SERVER_URL, "http://dev.myserver.com" buildConfigField "String", APP_VERSION, "0.0.1" } release { buildConfigField "String", SERVER_URL, "https://myserver.com" buildConfigField "String", APP_VERSION, "0.0.1" minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } I am getting and error as follows: /path/to/generated/BuildConfig.java Error:(14,

Confused about testCompile and androidTestCompile in Android Gradle

核能气质少年 提交于 2019-11-27 06:21:47
I'm new to testing world and even more to Android testing world. While doing research on Robolectric that aids with tests on android one thing confuses me the most. Sometimes on the web I see people using testCompile keyword in dependencies of the gradle build script when referencing Robolectric while others use androidTestCompile . Certainly both can't be valid? Can somebody explain the difference between the both and which of these should be the one used when using Robolectric? Simply testCompile is the configuration for unit tests (those located in src/test ) and androidTestCompile is used

Could not find or load main class org.gradle.wrapper.GradleWrapperMain

两盒软妹~` 提交于 2019-11-27 06:19:52
I cleaned the whole project by deleting local directories like ~/.gradle , ~/.m2 ~./android and ~/workspace/project/.gradle and chosing File -> Invalidate Caches / Restart... in Android Studio. Now execution of the command ./gradlew leads to the following output: usr$ ./gradlew tasks Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain Needless to say, I deleted too much, the question is how can it be repaired again? Do you have any ideas how to fix this? gradlew is the gradle wrapper executable - batch script on windows and shell script elsewhere. If you include the

Copy existing project with a new name in Android Studio

送分小仙女□ 提交于 2019-11-27 06:17:40
I would like to copy my Android project and create a new project from the same files just with a different name. The purpose of this is so I can have a second version of my app which is ad supported in the app store. I found this answer here: Android - copy existing project with a new name But it's for Eclipse. How can I do this in Android Studio? free3dom The steps in the link you specified should also work for Android Studio. Just make a copy (using a file manager) of the entire module folder and give it a new name. Now open it up and use Refactor -> Rename (right click on the item you want

Error: Execution failed for task ':app:clean'. Unable to delete file

旧城冷巷雨未停 提交于 2019-11-27 06:14:44
I'm trying to rebuild my Android Studio Gradle project (containing mostly Kotlin code), but it started to throw an UnableToDeleteFileException during the cleaning/rebuilding process: Execution failed for task ':app:clean'. > Unable to delete file: C:\Users\User\KotlinGameEngine\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.0.1\jars\classes.jar This started happening after I tried to change my project's package structure. Unfortunately, I did it by renaming and moving the source folders rather than refactoring through Android Studio, which was a bad idea. I've been

com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/maven/com.fasterxml.jackson.core/jackson-databind/pom.xml

ε祈祈猫儿з 提交于 2019-11-27 05:34:41
I am creating one app that uses a RestAPI to fetch data, and for that operation I am using retrofit 2, okhttp3 and jackson for parsing json to object, my app also use Firebase Cloud Messaging when I compile my code it gives me following error & I can't able to run it Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'. com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/maven/com.fasterxml.jackson.core/jackson-databind/pom.xml File1: /Users/silent/work/silentinfotech

Gradle is failing on syncing my project in the new Android Studio 2.0

╄→гoц情女王★ 提交于 2019-11-27 05:27:59
I have just upgraded (i.e., installed a full new version) my Android Studio from 1.5 to 2.0. The upgrade seemed to go smoothly, but I am having trouble with my project when I open it, when Gradle is syncing my project. After Gradle sync runs for a couple of minutes I get this error: Failed to sync Gradle project MyProject Unknown host 'jcenter.bintray.com'. You may need to adjust the proxy settings in Gradle. Error: Enable Gradle "offline mode' and sync project Learn about configuring HTTP proxies in Gradle So, I click on the link that says: Enable Gradle "offline mode' and sync project Then

My NDK project fails to compile with a CPU architecture-related issue

和自甴很熟 提交于 2019-11-27 05:20:30
Can someone explain why I get this errors please? Build command failed. Error while executing process C:\Users\Kevin\Desktop\Android\Sdk\ndk-bundle\ndk-build.cmd with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=C:\Users\Kevin\Desktop\Mygame\proj.android-studio\app\jni\Android.mk NDK_APPLICATION_MK=C:\Users\Kevin\Desktop\Mygame\proj.android-studio\app\jni\Application.mk APP_ABI=armeabi NDK_ALL_ABIS=armeabi NDK_DEBUG=1 APP_PLATFORM=android-14 NDK_OUT=C:/Users/Kevin/Desktop/Mygame/proj.android-studio/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=C:\Users\Kevin\Desktop\Mygame\proj