Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio make my test module depend of application module

I want to make in Android Studio my test module to be dependent of application module, but can not achieve this, have mistake

Error:Dependency AndroidApp:app:unspecified on project TestsRobotium resolves to an APK archive which is not supported as a compilation dependency. File: D:\android\MEWE\AndroidApp\app\build\apk\MeWe.apk

In my test.gradle I added provided project(':app') in dependency tag (it is done by Android studio automatically)

How would I resolve this? I need dependency on src, res folders of my main app and need to know R file

like image 719
Anton Kizema Avatar asked Jan 27 '15 08:01

Anton Kizema


People also ask

Where are module Dependencies declared in an Android project?

To use your new Android library's code in another app or library module within the same project, add a project-level dependency: Navigate to File > Project Structure > Dependencies. Select the Module in which you'll use the library. In the Declared Dependencies tab, click and select Module Dependency in the dropdown.

How do I add a dependency in gradle?

To add a dependency to your project, specify a dependency configuration such as implementation in the dependencies block of your module's build.gradle file.

What is dynamic feature module in Android Studio?

Dynamic feature modules allow you to separate certain features and resources from the base module of your app and include them in your app bundle. Through Dynamic Delivery, users can later download and install those components on demand after they've already installed the base APK of your app.

Can we import module from source in Android Studio?

Select the source directory of the Module you want to import and click Finish. Open Project Structure Dialog (You can open the PSD by selecting File > Project Structure) and from the left panel click on Dependencies. Select the module from the Module(Middle) section In which you want to add module dependency.


1 Answers

This is now possible using com.android.test plugin. Works fine for Java and resources stuff.

An example by Google can be found here.

Basically you create a separate module for testing and define which module and flavor should be tested. I've just checked it and it has some issues with working with the IDE, but runs fine with gradle command line.

like image 155
Marcin Kunert Avatar answered Oct 31 '22 22:10

Marcin Kunert