android-gradle

Android Studio - Gradle sync error

为君一笑 提交于 2019-11-28 09:06:33
I have a synchronization error in Android Studio. I Use: 1.0.2 version from canary channel. Gradle : I tried with version 2.2.1(downloaded from https://www.gradle.org/downloads ) and self-download version. JDK : jdk1.8.0_05 I created a new project and the error is always the same: Error:Unable to find method 'org.objectweb.asm.ClassReader.getMaxStringLength()I'. Possible causes for this unexpected error include: Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.) I tried resolve the issue with the invalidation of cache method , and stopping

Trying to use <!ENTITY in ANDROID resources with error: “The entity was referenced, but not declared.”

时光总嘲笑我的痴心妄想 提交于 2019-11-28 09:03:54
I'm following this solution to use enetities in my string resource file: Is it possible to do string substitution in Android resource XML files directly? I'm using an external file in the resource tree: /res/raw/entities.dtd , its content: <!ENTITY ent_devicename "MyDeviceName"> In the string.xml resource file: <!DOCTYPE resources [ <!ENTITY % ent_devicename SYSTEM "../raw/entities.dtd"> %ent_devicename; ]> <resources> <string name="name">The name is &ent_devicename;</string> </resources> but I get this error: The entity "ent_devicename" was referenced, but not declared. As you can see Android

Android release APK crash with java.lang.AssertionError: impossible in java.lang.Enum

十年热恋 提交于 2019-11-28 08:56:45
I've just built an APK using Gradle for release (ProGuard 4.9 and signed). When I launch the app it crash on this error : E/AndroidRuntime( 8662): java.lang.AssertionError: impossible E/AndroidRuntime( 8662): at java.lang.Enum$1.create(Enum.java:44) E/AndroidRuntime( 8662): at java.lang.Enum$1.create(Enum.java:35) E/AndroidRuntime( 8662): at libcore.util.BasicLruCache.get(BasicLruCache.java:54) E/AndroidRuntime( 8662): at java.lang.Enum.getSharedConstants(Enum.java:210) E/AndroidRuntime( 8662): at java.lang.Enum.valueOf(Enum.java:190) E/AndroidRuntime( 8662): at kr.infli.s.Z(Inflikr.java:390)

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve

大兔子大兔子 提交于 2019-11-28 08:54:34
Newly installed Android studio 3.1.3 is giving strange dependencies error when making a new project and compiling for very first time. A similar question that didn't help resolve the problem. Event Logs: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:appcompat-v7:28.0.0-alpha3. Open File Show Details Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support.constraint:constraint-layout:1.1.2. Open File Show Details Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could

Why is my JSONObject related unit test failing?

▼魔方 西西 提交于 2019-11-28 08:54:11
I'm running my tests using gradle testFlavorType JSONObject jsonObject1 = new JSONObject(); JSONObject jsonObject2 = new JSONObject(); jsonObject1.put("test", "test"); jsonObject2.put("test", "test"); assertEquals(jsonObject1.get("test"), jsonObject2.get("test")); The above test succeeds. jsonObject = new SlackMessageRequest(channel, message).buildBody(); String channelAssertion = jsonObject.getString(SlackMessageRequest.JSON_KEY_CHANNEL); String messageAssertion = jsonObject.getString(SlackMessageRequest.JSON_KEY_TEXT); assertEquals(channel, channelAssertion); assertEquals(message,

Localizing string resources added via build.gradle using “resValue”

不想你离开。 提交于 2019-11-28 08:27:35
This is in continuation to an answer which helped me on this post We can add the string resource as follows from build.gradle : productFlavors { main{ resValue "string", "app_name", "InTouch Messenger" } googlePlay{ resValue "string", "app_name", "InTouch Messenger: GPE Edition" } } It works like a charm and serves the purpose of having different app names per flavor. (with the original app_name string resource deleted from strings.xml file. But, how do we add localized strings for this string resource added from build.gradle ? Is there an additional parameter we can pass specifying the locale

Gradle in Android Studio: Failed to resolve third-party libraries

大城市里の小女人 提交于 2019-11-28 08:24:47
I have been trying to switch my project from Intellij to Android Studio, which has required me to create a build.gradle file. I know I can add each of these as a library dependency, but I ideally want to be able to get the maven repository dependency working. Every time I sync, my support libraries are synced fine, but for each third-party library, I get something like "Error:(30, 13) Failed to resolve: com.facebook.android:facebook-android-sdk:3.23.1" for each library. buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:1.1.0' } } apply

android - Execution failed for task ':app:compileDebugJavaWithJavac'

∥☆過路亽.° 提交于 2019-11-28 08:18:42
New to Android Studio + Gradle. I'm trying to run my app from the command line using: gradlew installDebug The app gets installed on my device only when I execute that command when Studio just got opened and do that initial syncing/building thing. Whenever I modified my code, and try to run that command again, the build fails and shows this error: Execution failed for task ':app:compileDebugJavaWithJavac' > Could not find tools.jar How do I solve this problem? Thanks in advance. Setting the JAVA_HOME variable to C:\Program Files\Java\jdkX.XX worked for me. It was previously set to the JRE

Android Studio - Gradle sync project failed

拈花ヽ惹草 提交于 2019-11-28 08:09:43
In Android Studio, I simply created a new project, and it says that: Gradle project sync failed. Basic functionality will not work properly. I have searched the web and tried everything, but nothing worked. I have v0.4.6 of Android Studio using Gradle 1.11. The Error Message Is: FAILURE: Build failed with an exception. * Where: Build file 'C:\Users\Vinnie\AndroidStudioProjects\MyFirstAppProject\MyFirstApp\build.gradle' line: 9 * What went wrong: A problem occurred evaluating project ':MyFirstApp'. > Gradle version 1.10 is required. Current version is 1.11. If using the gradle wrapper, try

Android Gradle Implementation vs CompileOnly Performance

亡梦爱人 提交于 2019-11-28 08:09:06
The docs mention that implementation provides significant build time improvements over compile / api . What about compileOnly ? My use case is a multi-module (sorry I don't like Gradle's multi-project terminology) project, where I have an Android app, and multiple libraries that the app depends on ( implementation ). Some of the libraries also depend on one another. Should I use implementation or compileOnly when declaring dependencies in the library modules? My app module will be using implementation to depend on those artifacts, so I don't need them to be transitive through the library