I\'ve imported a project to Android Studio with several subprojects.
I want to run a subproject.
I successfully made this subproject\'s build.gradle as a mo
For me it was:
Right click on app
project folder & select Load/Unload Modules...
Select app
module, click Unload >
, & click OK
Right click on app
again & select Load/Unload Modules...
Select app
module, click < Load
, & click OK
app
then appeared for me in the configurations list again.
Try,
Files > Sync Project with Gradle Files or Files > Sync with File System Should do the trick.
I finally figure out why the module is not showed up when I add configuration for AndroidTests for a com.android.library
module.
If you include your library module in your application's build.gradle
like this:
compile project(':yourlibrary')
Since for library module it is compiled with release
mode by default, you can't run Android Tests
for it, that's why it won't show up in the module list.
I fixed it with following modification:
Add following configuration to the build.gradle
of your library module:
publishNonDefault true
By make following changes, you can debug
compile your library by editing the build.gradle
of your application module like following:
- compile project(':yourlibrary')
+ debugCompile project(path: ':yourlibrary', configuration: 'debug')
+ releaseCompile project(path: ':yourlibrary', configuration: 'release')
Then sync it and you'll find it shows in the list.
In my case problem was from a higher (or not downloaded) compileSdkVersion and targetSdkVersion in build.gradle(app). This was happened because of cloning project in another pc that not downloaded that sdk image.
The following are methods to help you:
:app
This mainly happens when you copy a library project and try to build it. The solution would be to add
apply plugin: 'com.android.application'
in the build.gradle file, instead of
apply plugin: 'com.android.library'
Then do a gradle sync