EgorBo / EgorBo/Xamaridea

Android Studio 3 and mvvmcross

Open
#14 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
76
Forks
22
PR merge metrics
No merged PRs in 30d

Description

Hi,
when a project layout file (xml) contains custom tags originating from an android library referenced in the android project (like mvvmcross), the gradle build fails as it can't find them.

It can't find them because XamarIdea does not add in ``app\build.gradle`` (in ``sourceSets/main/res.srcDirs`` tag) the ``obj/Debug/__library_projects__/*`` folders, which contains Android resources from these referenced assemblies.

A workaround is to manually update the build.gradle file and manually add each ``__library_projects__`` folder

```
apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.egorbo.javashallowcopyforxamarinproject"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

sourceSets {
main {
res.srcDirs = [
'C:/Dev/repos/totoapp/Toto/Toto.Droid/Resources',
'C:/Dev/repos/totoapp/Toto/Toto.Droid/obj/Debug/__library_projects__/XamSvg.Droid/library_project_imports/res',
'C:/Dev/repos/totoapp/Toto/Toto.Droid/obj/Debug/__library_projects__/Vapolia.WheelPickerDroid/library_project_imports/res',
'C:/Dev/repos/totoapp/Toto/Toto.Droid/obj/Debug/__library_projects__/MvvmCross.Binding.Droid/library_project_imports/res',
'C:/Dev/repos/totoapp/Toto/Toto.Droid/obj/Debug/__library_projects__/MvvmCross.Droid.Support.V7.RecyclerView/library_project_imports/res'
]
}
}
}

```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure with an Android project using custom XML tags from a referenced library, then inspect how app\build.gradle and sourceSets/main/res.srcDirs are generated. Done means the generated Gradle resource paths include the referenced obj/Debug/__library_projects__ folders and the project builds successfully in Android Studio.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, csharp
Domain
build-system, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.