android-gradle

Unsupported method: AndroidProject.getVariantNames() in Android Studio 3.4

[亡魂溺海] 提交于 2019-11-28 20:07:48
I just updated to Android Studio 3.4 (Canary 5) . Then I opened my existing project (which worked perfectly on Android Studio 3.3 Beta) and received this error: ERROR: Unsupported method: AndroidProject.getVariantNames(). The version of Gradle you connect to does not support that method. To resolve the problem you can change/upgrade the target version of Gradle you connect to. Alternatively, you can ignore this exception and read other information from the model. Full clean & rebuild, Invalidate cache & restart, re-import project does not work. gradle-wrapper.properties : distributionBase

invokedynamic requires --min-sdk-version >= 26

眉间皱痕 提交于 2019-11-28 20:05:35
Today downloaded the studio 3.0 beta 2.0 version, after that tried to open an existing project in it and faced some difficulties, most of them I could solve with the help of Google and Stack Overflow, but this one I can not. Error:Execution failed for task ':app:transformClassesWithDexBuilderForDebug'. > com.android.build.api.transform.TransformException: org.gradle.tooling.BuildException: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26) Also posting my app gradle apply plugin: 'com.android.application' android { compileSdkVersion 26

Automatically solve Android build Error:Frame pixels must be either solid or transparent (not intermediate alphas). - Found at pixel #4 along top edge

若如初见. 提交于 2019-11-28 19:37:14
Android Studio (using SDK 19, 21 or 22) shows an error that Eclipse ADT (using SDK 19) does not: Error:9-patch image D:\Workspaces....\res\drawable-hdpi\btn_bg_common_press.9.png malformed. Error:Frame pixels must be either solid or transparent (not intermediate alphas). - Found at pixel #4 along top edge. Or another error : Error:Ticks in transparent frame must be black or red. both within aapt Error:Error: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'E:\Android\sdk-Android-Studio\build-tools\19.1.0\aapt.exe'' finished with non

How to add .aar dependency in library module?

早过忘川 提交于 2019-11-28 19:21:52
I am having one .aar file of one library module. I want to use it as a library or dependency in my other project's library module. How do I do it? I tried options provided at below links: http://kevinpelgrims.com/blog/2014/05/18/reference-a-local-aar-in-your-android-project/ It works only if I add .aar reference in my project's application module. But not working in library module. Thanks. Follow this setting and you will able to add .aar dependency to library module build.gradle (Project: ....) allprojects { repositories { jcenter() mavenCentral() flatDir { dirs 'libs' dirs project(':library

Android studio, configure gradle project takes forever

♀尐吖头ヾ 提交于 2019-11-28 19:11:54
After changing the gradle build file to use gradle build tool 0.8.+, classpath 'com.android.tools.build:gradle:0.8.+' my Android studio is stuck forever at "refreshing X Gradle project". I tried to restart AS, didn't work. I did even change gradle build tool back to 0.7.+, even downgrade my AS from 0.4.4 back to 0.4.2, still no hopes. Anyone experienced this before? pls help Tks. Update : now I tried deleting all old .iml files and .idea folder, and reimported, now it's stuck at "Building X Gradle project info", seems like forever. Building from commandline is perfectly fine. Update 2: Log

Android gradle build: how to set global variables

拜拜、爱过 提交于 2019-11-28 19:05:42
How can I set a global variable that can be accessed from build.gradle and tasks? To set a global variable project.ext.set("variableName", value) To access it from anywhere in the project: project.variableName For instance: project.ext.set("newVersionName", versionString) and then... println project.newVersionName For more information see: http://www.gradle.org/docs/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html EDIT : As commented by Dmitry, In new versions you can use the following shorthand: project.ext.variableName = value The answer from Guy is excellent. I just want to

Android wear application packaging fails with flavours

泄露秘密 提交于 2019-11-28 18:22:47
I have an application that includes a wear app. All works fine on debug tested with a real device. I can alse create the release apk that packs the wear apk inside it. But only if there is only one flavour on my application. I want to maintain two versions of the application with different applicationId, but although this compile without errors, in this case the two release apks (one of each flavour) don't cointain the corresponding wear apks. This is the relevant part of the mobile app build.gradle: productFlavors { Trial { applicationId "com.example.myapp.trial" versionName "3.0.1"

build failing during merge resources with Android Gradle plugin 3.3.0

偶尔善良 提交于 2019-11-28 18:18:07
I have a lot of different flavors for my build that have specific resources and I don't want to clutter my src directory in my project with a bunch of flavor-specific directories, so I add the source sets from another folder in my project prior to the mergeResources task (mergeResources.doFirst). This has always worked for the past several versions of the Android Gradle plug-in (3.1.0-3.2.0 and some of the 3.3.0-alpha versions), but at a certain point, the 3.3.0-alpha AGP started causing build failures during this mergeResources task. Now I keep getting: BUILD FAILED in 35s 16 actionable tasks

RxJavaPlugins Error Didn't find class “com.google.devtools.build.android.desugar.runtime.ThrowableExtension”

旧街凉风 提交于 2019-11-28 18:15:36
After upgrading Android Studio 3.0 Beta 1 getting the following error. When I downgraded the error disappeared. Studio Build: Android Studio 3.0 Beta 1 Version of Gradle Plugin: 'com.android.tools.build:gradle:3.0.0-beta1' Version of Gradle:.0.0-beta1 Version of Java: 8 OS: MacOSX java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/devtools/build/android/desugar/runtime/ThrowableExtension; at io.reactivex.plugins.RxJavaPlugins.onError(RxJavaPlugins.java:364) at io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run(HandlerScheduler.java:113) at android.os.Handler

How to change libs directory in Gradle?

廉价感情. 提交于 2019-11-28 18:01:46
I want to integrate Zbar into my application but cant seem to figure out how to accomplish this using the new Android Studio. I have looked through the example and have copied over the code without any issues. The problem I am having is adding the libs to my project I cant seem to figure out how to do it. Could someone walk me through it? Actually, @Michael's answer is correct, it is also obsolete. Now, using gradle all you need to do is to add the lines below in the build.gradle file: android { ... sourceSets { main.jniLibs.srcDirs = ['libs'] test.jniLibs.srcDirs = ['libs'] } } or directly