android-gradle

How to unit test Retrofit api calls?

元气小坏坏 提交于 2019-11-29 20:34:18
I am trying to integrate Unit test cases for every chunk of code possible. But I am facing issues while adding test cases for api calls that are made through retrofit. The JUnit compiler never executes the code in the CallBack functions . There is another option of making all the api calls Synchronous for testing purpose, but that's not possible for every case in my app. How can I sort this out? I have to add test cases in the api calls by any means. maciekjanusz I test my Retrofit callbacks using Mockito, Robolectric and Hamcrest libraries. First of all, set up lib stack in your module's

Dagger2 dependency - Gradle

痞子三分冷 提交于 2019-11-29 20:25:01
I'm trying to add Dagger2 to my project in Android Studio but I can't find proper dependency to paste in build.gradle. Could you help and send me the proper line? Installing Dagger 2 on Android Studio 2 // Application build.gradle dependencies { compile 'com.google.dagger:dagger:2.4' annotationProcessor "com.google.dagger:dagger-compiler:2.4" } Maven Repositories: Find the latest versions of the above dependencies in the Maven Repository: dagger dagger-compiler Notes: Android Studio < 2.2 Older versions of Android Studio need android-apt for annotation processing. // Project build.gradle

How can I add flavors in a module with Android Studio?

我是研究僧i 提交于 2019-11-29 20:19:24
I have a suite of projects that use the same module, which contains nearly all the actual code. The project is setup like: project/ - app/ - build.gradle - libraries/ - module/ - build.gradle - build.gradle - settings.gradle The dependencies are all setup correctly, and I can build and run apps great, however I can only add flavors to the project, which is not the ideal solution. settings.gradle contains the following: include ':app', ':libraries:module' In the app directory's build.gradle file, I added the following block: productFlavors { alpha production } Using gradle 0.11, this syncs and

How to check the gradle version in Android Studio?

杀马特。学长 韩版系。学妹 提交于 2019-11-29 20:14:08
When compiling this official project with Android Studio 0.82, it shows error note: Error:The project is using an unsupported version of the Android Gradle plug-in (0.9.2) After some searching, I decide to manually change content in the build.gradle file in line classpath 'com.android.tools.build:gradle:0.9.+' to the gradle version that is installed in Android Studio. The question is, can how to check the gradle version in my Android Studio? Scott Barta File->Project Structure->Project pane->"Android plugin version". Make sure you don't confuse the Gradle version with the Android plugin

How to build FFmpeg (ver 3.1.1) on Android Studio (ver 2.1.2)

女生的网名这么多〃 提交于 2019-11-29 18:07:19
I try to build and use FFmpeg Library on Android Studio. My Environments Windows 7 64bit, Cygwin64, Android Studtio 2.1.2, FFmpeg 3.1.1, Android NDK r12b Ref. Page http://www.roman10.net/2013/08/18/how-to-build-ffmpeg-with-ndk-r9/ I follow this page. I succeed FFmpeg library build using ./build_android.sh on Cygwin so I try to use FFmpeg Library's on Android Studio. Setting Android Studio for use FFmpeg my project_path/jni/Android.mk LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := ffmpeg_trim LOCAL_SRC_FILES := ffmpeg_trim.c LOCAL_LDLIBS := -lz -ljnigraphics LOCAL_SHARED

Build fails with app:transformClassesAndResourcesWithProguardForRelease on upgrading gradle version to 2.3.3

╄→гoц情女王★ 提交于 2019-11-29 17:41:00
I have my gradle to 2.3.3. It is working fine in debug mode. But when i am running this in release mode with proguard enabled, It is thorwing this exception Warning:Exception while processing task java.io.IOException: java.lang.NullPointerException Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForProdRelease'. I have checked many solution on stackoverflow like same problem as mine but this solution didn't work On running gradlew assembleRelease --stacktrace command in terminal org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app

Unable to run project on android emulator but works with Iphone

无人久伴 提交于 2019-11-29 17:23:12
I have been having an issue running my project on the android emulator, I have had several problems and currently, I am facing this: I have had several problems before getting to thhis one where I have to change classpath 'com.android.tools.build:gradle:3.3.0' and distributionUrl=https://services.gradle.org/distributions/gradle-4.10.1-all.zip but this new error still persists. If there is any additional information required to solve this please do ask. Thanks What went wrong: A problem occurred evaluating project ':expo-react-native-adapter'. Project with path ':expo-core' could not be found

App Bundle build fails because of the sym_keyboard_feedback_delete.png file

北慕城南 提交于 2019-11-29 16:55:56
I am trying to build my app using the Android app bundle. The apk gets generated fine but the bundle doesn't due to a "reserved file or directory name 'res'". Oddly it singles out this drawable file which exists only in the Android pie (28) SDK folder. I'm not using it anywhere in my module. sym_keyboard_feedback_delete.png I'm using the latest gradle version (3.2.1) and compiling against Android Pie (28). Any ideas? FAILURE: Build failed with an exception. What went wrong: Execution failed for task ':packageProductionReleaseBundle'. > java.util.concurrent.ExecutionException: com.android.tools

Could not find aapt2-proto.jar (com.android.tools.build:aapt2-proto:0.3.1)

爱⌒轻易说出口 提交于 2019-11-29 16:45:06
I'm using Android Studio to work with tomahawk-android project, so i cloned the project using git , directly into the Android Studio , where it fails to build, saying; Could not find aapt2-proto.jar (com.android.tools.build:aapt2-proto:0.3.1). Searched in the following locations: https://jcenter.bintray.com/com/android/tools/build/aapt2-proto/0.3.1/aapt2-proto-0.3.1.jar build.gradle: apply plugin: "com.android.application" android { implementationSdkVersion 23 buildToolsVersion '23.0.3' defaultConfig { minSdkVersion 15 targetSdkVersion 22 renderscriptTargetApi 20 renderscriptSupportModeEnabled

Unable to compile any Android project due to Gradle fail: Could not find javax.xml.datatype.DatatypeFactory

为君一笑 提交于 2019-11-29 16:26:45
This is really bugging me, I've installed and reinstalled JDK, ADK, Android Studio, and Gradle several times and in various different orders, but I can't get this error to go away. Either I'm not deleting enough when I uninstall, or there's some incompatibility with OS X Yosemite. It's also possible that I'm not pointing Android Studio at the right JDK or ADK... Basically, no idea what's going on. Any help would be greatly appreciated. Here's the gradle stacktrace: org.gradle.internal.service.ServiceCreationException: Could not create service of type DefaultClassLoaderRegistry using