Xamaridea
Xamaridea copied to clipboard
Android Studio 3 and mvvmcross
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'
]
}
}
}