I'm trying run PreEmptive.Protection.Dotfuscator.Pro[.Eval] -Version 6.0.1 in project Xamarin.Android that include Nuget to aid migration from Android Support to Android X:
<PackageReference Include="Xamarin.AndroidX.Migration">
<Version>1.0.4</Version>
</PackageReference>
but the result is this:
"/Droid/Droid.csproj" (default target) (6) ->
(_AndroidXCecilfy target) ->
/.nuget/packages/xamarin.androidx.migration/1.0.4/buildTransitive/monoandroid90/Xamarin.AndroidX.Migration.targets(227,9): error : Symbols were found but are not matching the assembly [/Droid/Droid.csproj]
/.nuget/packages/xamarin.androidx.migration/1.0.4/buildTransitive/monoandroid90/Xamarin.AndroidX.Migration.targets(227,9): error : at Mono.Cecil.ModuleDefinition.ReadSymbols (Mono.Cecil.Cil.ISymbolReader reader, System.Boolean throwIfSymbolsAreNotMaching) [0x0003c] in <1b16609822914d769fb771c1bb74cd3b>:0 [/Droid/Droid.csproj]
/.nuget/packages/xamarin.androidx.migration/1.0.4/buildTransitive/monoandroid90/Xamarin.AndroidX.Migration.targets(227,9): error : at Mono.Cecil.ModuleReader.ReadSymbols (Mono.Cecil.ModuleDefinition module, Mono.Cecil.ReaderParameters parameters) [0x00060] in <1b16609822914d769fb771c1bb74cd3b>:0 [/Droid/Droid.csproj]
/.nuget/packages/xamarin.androidx.migration/1.0.4/buildTransitive/monoandroid90/Xamarin.AndroidX.Migration.targets(227,9): error : at Mono.Cecil.ModuleReader.CreateModule (Mono.Cecil.PE.Image image, Mono.Cecil.ReaderParameters parameters) [0x00081] in <1b16609822914d769fb771c1bb74cd3b>:0 [/Droid/Droid.csproj]
/.nuget/packages/xamarin.androidx.migration/1.0.4/buildTransitive/monoandroid90/Xamarin.AndroidX.Migration.targets(227,9): error : at Mono.Cecil.ModuleDefinition.ReadModule (Mono.Disposable1[T] stream, System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x0000d] in <1b16609822914d769fb771c1bb74cd3b>:0 [/Droid/Droid.csproj]
/.nuget/packages/xamarin.androidx.migration/1.0.4/buildTransitive/monoandroid90/Xamarin.AndroidX.Migration.targets(227,9): error : at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x0006c] in <1b16609822914d769fb771c1bb74cd3b>:0 [/Droid/Droid.csproj]
/.nuget/packages/xamarin.androidx.migration/1.0.4/buildTransitive/monoandroid90/Xamarin.AndroidX.Migration.targets(227,9): error : at Mono.Cecil.AssemblyDefinition.ReadAssembly (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x00000] in <1b16609822914d769fb771c1bb74cd3b>:0 [/Droid/Droid.csproj]
/.nuget/packages/xamarin.androidx.migration/1.0.4/buildTransitive/monoandroid90/Xamarin.AndroidX.Migration.targets(227,9): error : at Xamarin.AndroidX.Migration.CecilMigrator.Migrate (System.String source, System.String destination) [0x001c2] in <865a8af74cb24987acc1eca3a5f0df36>:0 [/Droid/Droid.csproj]
/.nuget/packages/xamarin.androidx.migration/1.0.4/buildTransitive/monoandroid90/Xamarin.AndroidX.Migration.targets(227,9): error : at Xamarin.AndroidX.Migration.CecilMigrator.Migrate (System.Collections.Generic.IEnumerable1[T] assemblies) [0x00012] in <865a8af74cb24987acc1eca3a5f0df36>:0 [/Droid/Droid.csproj]
/.nuget/packages/xamarin.androidx.migration/1.0.4/buildTransitive/monoandroid90/Xamarin.AndroidX.Migration.targets(227,9): error : at Xamarin.AndroidX.Migration.BuildTasks.CecilfyFiles.Execute () [0x000e3] in <770add7f13554ba8ad474c9c8fea5326>:0 [/Droid/Droid.csproj]
Information about the build agent OS:
=== Visual Studio Community 2019 for Mac ===
Version 8.5.4 (build 12)
Installation UUID: 097d734b-78c4-46b2-a654-ed5233f4a357
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 6.14.1.39 (d16-5 / 30e8706b4)
=== Mono Framework MDK ===
Runtime:
Mono 6.8.0.123 (2019-10/1d0d939dc30) (64-bit)
Package version: 608000123
=== .NET Core SDK ===
SDK: /usr/local/share/dotnet/sdk/3.1.200/Sdks
SDK Versions:
3.1.200
2.1.701
2.1.504
2.1.302
2.1.4
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.8.0/lib/mono/msbuild/Current/bin/Sdks
=== Xamarin.Android ===
Version: 10.0.6.2 (Visual Studio Community)
Commit: xamarin-android/d16-3/c407838
Android SDK: /Users/emegonza/Library/Android/sdk
Supported Android versions:
6.0 (API level 23)
8.1 (API level 27)
SDK Tools Version: 26.1.1
SDK Platform Tools Version: 30.0.0
SDK Build Tools Version: 30.0.0 rc2
Build Information:
Mono: mono/mono/2019-06#476d72b9e32
Java.Interop: xamarin/java.interop/d16-3#5836f58
LibZipSharp: grendello/LibZipSharp/d16-3#71f4a94
LibZip: nih-at/libzip/rel-1-5-1#b95cf3fd
ProGuard: xamarin/proguard/master#905836d
SQLite: xamarin/sqlite/3.27.1#8212a2d
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-3#cb41333
=== Operating System ===
Mac OS X 10.15.5
Darwin 19.5.0 Darwin Kernel Version 19.5.0
Tue May 26 20:41:44 PDT 2020
I run dotfuscator with this lines in the DotfuscatorConfig.xml, to see the error
<global>
<option>verbose</option>
</global>
Can you help me to find, why this problem happen and how to fix it?
Related
I am new to react-native and I have to do the support on an app.
I can’t compile it on Android. I get an error while building it either by command line or from the android studio.
My configuration :
$ react-native info
info Fetching system and libraries information...
(node:21418) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
System:
OS: Linux 5.15 Ubuntu 20.04.5 LTS (Focal Fossa)
CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1185G7 # 3.00GHz
Memory: 228.16 MB / 7.68 GB
Shell: 5.0.17 - /bin/bash
Binaries:
Node: 14.21.2 - ~/.nvm/versions/node/v14.21.2/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v14.21.2/bin/yarn
npm: 6.14.17 - ~/.nvm/versions/node/v14.21.2/bin/npm
Watchman: Not Found
SDKs:
Android SDK:
API Levels: 30, 33, 33
Build Tools: 29.0.2, 30.0.2, 30.0.3, 31.0.0, 33.0.1
System Images: android-30 | Google APIs Intel x86 Atom, android-33 | Google APIs Intel x86 Atom_64
Android NDK: Not Found
IDEs:
Android Studio: AI-213.7172.25.2113.9123335
Languages:
Java: 11.0.17 - /lib/jvm/java-1.11.0-openjdk-amd64/bin/javac
npmPackages:
#react-native-community/cli: ^10.1.0 => 10.1.0
react: ^18.1.0 => 18.2.0
react-native: 0.70.6 => 0.70.6
npmGlobalPackages:
*react-native*: Not Found
The command line :
react-native run-android --variant=stagingDebug --appId com.< app name>.staging
Error that I get :
> Task :app:compileStagingDebugJavaWithJavac FAILED
359 actionable tasks: 6 executed, 353 up-to-date
<myProject root path>/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:99: error: package com.< app name>.staging does not exist
new CodePush(com.< app name>.staging.BuildConfig.CODEPUSH_KEY, this.getApplication(), com.< app name>.staging.BuildConfig.DEBUG),
react-native.config.js :
module.exports = {
dependencies: {
// disable autolinking for these unsupported libraries
// #codepush
'react-native-code-push': {
platforms: {
android: {
packageImportPath: 'import com.microsoft.codepush.react.CodePush;',
packageInstance:
'new CodePush(BuildConfig.CODEPUSH_KEY, this.getApplication(), BuildConfig.DEBUG)',
},
},
},
},
};
I hope someone can help me!
verifyReleaseResources keeps failing for my android assembleRelease build.
A description of my react-native build
System:
OS: macOS 12.6
CPU: (10) x64 Apple M1 Max
Memory: 22.59 MB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 14.19.1 - ~/.nvm/versions/node/v14.19.1/bin/node
Yarn: 1.22.18 - ~/github/snackpass/snackpass-client/node_modules/.bin/yarn
npm: 8.19.2 - /opt/homebrew/bin/npm
Watchman: 2022.10.31.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK: Not Found
IDEs:
Android Studio: Dolphin 2021.3.1 Patch 1 Dolphin 2021.3.1 Patch 1
Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
Languages:
Java: 11.0.11 - /Users/alitamoore/.jenv/shims/javac
npmPackages:
#react-native-community/cli: Not Found
react: 17.0.1 => 17.0.1
react-native: ^0.64.4 => 0.64.4
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
Here’re some sample errors I got
(Warning/Error) Argfile not found
Argfile not found: /Users/alitamoore/Library/Application Support/kotlin/daemon/promotedai_react-native-metrics_release
(error) Incompatible kotlin version
/Users/alitamoore/.gradle/caches/transforms-3/39d9fb5957939f0b72af860a8de1b4e0/transformed/jetified-kotlin-stdlib-jdk7-1.6.10.jar!/META-INF/kotlin-stdlib-jdk7.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.15.
/Users/alitamoore/.gradle/caches/transforms-3/556bb75edc66f947ffbea3dd348ad797/transformed/jetified-kotlin-stdlib-common-1.6.10.jar!/META-INF/kotlin-stdlib-common.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.15.
/Users/alitamoore/.gradle/caches/transforms-3/572b2229271f904a5c21007cf91f4994/transformed/jetified-react-native-0.71.0-rc.0-release-api.jar!/META-INF/ReactAndroid_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.15.
/Users/alitamoore/.gradle/caches/transforms-3/687b7f7119d3db63f03c30ceb978b8e7/transformed/jetified-kotlin-stdlib-1.6.10.jar!/META-INF/kotlin-stdlib.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.15.
/Users/alitamoore/.gradle/caches/transforms-3/b89184fd2243c0ba9c21f04aac02ee1a/transformed/jetified-kotlin-stdlib-jdk8-1.6.10.jar!/META-INF/kotlin-stdlib-jdk8.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.15.
If I force the kotlin version the dependency to 1.6.0 then I get another error
(Error) failed linking file resources
Execution failed for task ':promotedai_react-native-metrics:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> 1 exception was raised by workers:
com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
AAPT: /Users/alitamoore/github/snackpass/snackpass-client/node_modules/#promotedai/react-native-metrics/android/build/intermediates/res/merged/release/layout/autofill_inline_suggestion.xml:18: error: resource attr/autofillInlineSuggestionChip (aka ai.promoted:attr/autofillInlineSuggestionChip) not found.
/Users/alitamoore/github/snackpass/snackpass-client/node_modules/#promotedai/react-native-metrics/android/build/intermediates/res/merged/release/layout/autofill_inline_suggestion.xml:25: error: resource attr/autofillInlineSuggestionStartIconStyle (aka ai.promoted:attr/autofillInlineSuggestionStartIconStyle) not found.
/Users/alitamoore/github/snackpass/snackpass-client/node_modules/#promotedai/react-native-metrics/android/build/intermediates/res/merged/release/layout/autofill_inline_suggestion.xml:32: error: resource attr/autofillInlineSuggestionTitle (aka ai.promoted:attr/autofillInlineSuggestionTitle) not found.
/Users/alitamoore/github/snackpass/snackpass-client/node_modules/#promotedai/react-native-metrics/android/build/intermediates/res/merged/release/layout/autofill_inline_suggestion.xml:41: error: resource attr/autofillInlineSuggestionSubtitle (aka ai.promoted:attr/autofillInlineSuggestionSubtitle) not found.
/Users/alitamoore/github/snackpass/snackpass-client/node_modules/#promotedai/react-native-metrics/android/build/intermediates/res/merged/release/layout/autofill_inline_suggestion.xml:50: error: resource attr/autofillInlineSuggestionEndIconStyle (aka ai.promoted:attr/autofillInlineSuggestionEndIconStyle) not found.
error: failed linking file resources.
This error is also unpredictable, sometimes after clearing cache it passes the build.
I don’t know why this happens, exactly. But I do know that removing the offending linked packages (note that links only apply RN < 0.69.0) from android/settings.gradle fixes it.
e.g. remove these lines (in the example given)
include ':#promotedai_react-native-metrics'
project(':#promotedai_react-native-metrics').projectDir = new File(rootProject.projectDir, '../node_modules/#promotedai/react-native-metrics/android')
While I was debugging this, I also found some useful solutions to the errors mentioned. They may be useful:
Argfile not found
Try
cd android
./gradlew clean
Incompatible Kotlin Version
If you notice in the above errors it says The binary version of its metadata is 1.6.0, expected version is 1.1.15 but 1.1.15 is not a valid version of Kotlin. So if you override that with a valid version it’ll fix the issue. Try applying it project wide first (android/build.gradle)
buildScript {
ext {
kotlinVersion = “1.6.0”
}
}
If that has issues, then you can override it directly in the dependency and then save those changes with patch-package
failed linking file resources
In some cases you may see error: resource android:attr/lStar not found. In that case, see Saurabh’s suggestion or this video I found useful.
Although this question has been asked by others, none of the provided solutions work for my use case.
Environment
System:
OS: macOS 12.3.1
CPU: (10) arm64 Apple M1 Pro
Memory: 202.25 MB / 32.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.1.0 - ~/.nvm/versions/node/v16.1.0/bin/node
Yarn: 1.22.19 - ~/.yarn/bin/yarn
npm: 7.11.2 - ~/.nvm/versions/node/v16.1.0/bin/npm
Watchman: 2022.03.21.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK: Not Found
IDEs:
Android Studio: 2021.2 AI-212.5712.43.2112.8609683
Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
Languages:
Java: 11.0.15 - /Users/AH94896/.jenv/shims/javac (Using Java 1.8 gives same result)
npmPackages:
#react-native-community/cli: Not Found
react: 16.14.0 => 16.14.0
react-native: 0.64.1 => 0.64.1
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
------------------------------------------------------------
Gradle 6.5.1
------------------------------------------------------------
Build time: 2020-06-30 06:32:47 UTC
Revision: 66bc713f7169626a7f0134bf452abde51550ea0a
Kotlin: 1.3.72
Groovy: 2.5.11
Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM: 11.0.15 (Eclipse Adoptium 11.0.15+10)
OS: Mac OS X 12.3.1 x86_64
Description
I can clean the app using ./gradlew clean. But when launching using npx react-native run-android, the build fails in the same spot:
> Configure project :react-native-reanimated
No AAR for react-native-reanimated found. Attempting to build from source.
Native libs debug enabled: false
Android gradle plugin: 4.1.0
Gradle: 6.5.1
building Reanimated2
> Task :react-native-reanimated:compileDebugJavaWithJavac FAILED
The place in the build process where it goes awry is this
/Users/AH94896/projects/app/node_modules/react-native-reanimated/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedUIImplementation.java:13: error: cannot find symbol
ViewManagerResolver viewManagerResolver,
^
symbol: class ViewManagerResolver
location: class ReanimatedUIImplementation
/Users/AH94896/projects/app/node_modules/react-native-reanimated/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedUIImplementation.java:11: error: recursive constructor invocation
public ReanimatedUIImplementation(
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-reanimated:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
The REALLY odd fact is that NO ONE else on my team experiences this problem whether using Apple M1 or Intel Macs. I have exhausted every resource I've found searching for a solution.
Please ask if you need more info. This is a critical blocker for my project work.
My Xamarin.Android app can no longer be deployed to an emulator/device. I can compile it successfully and the deployment process is started but in the end it fails. I'm using Visual Studio for Mac and Xamarin.Android:
[INSTALL_FAILED_INVALID_APK: Package couldn't be installed in
/data/app/my.app.bundle.id-agudyKm4Ib_8OheG3_5zmg==: Package
/data/app/my.app.bundle.id-agudyKm4Ib_8OheG3_5zmg==/base.apk code is
missing]
My build configuration is below:
Multi-dex = ON because without it I'm getting the DEX size error
DEX compiler = DX (D8 doesn't work, I'm getting a compilation error that some classes are missing, see below)
Code shrinker = Off (this is a debug build to run on local emulator/device)
This error occurs if I set DEX compiler to D8:
R8 : warning : Missing class: androidx.appcompat.widget.AppCompatEditText (and 10 more similar errors)
missing R8 : error : Compilation can't be completed because some library classes are missing.
The error occurs with all the settings above, this is basically the only configuration I can build my app but unable to deploy it to device:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: Deployment failed
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: Mono.AndroidTools.InstallFailedException: Failure [INSTALL_FAILED_INVALID_APK: Package couldn't be installed in /data/app/my.app.bundle.id-agudyKm4Ib_8OheG3_5zmg==: Package /data/app/my.app.bundle.id-agudyKm4Ib_8OheG3_5zmg==/base.apk code is missing]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess (System.String output, System.String packageName) [0x00152] in /Users/runner/runners/2.165.0/work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/Internal/AdbOutputParsing.cs:341
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: at Mono.AndroidTools.AndroidDevice+<>c__DisplayClass95_0.<InstallPackage>b__0 (System.Threading.Tasks.Task`1[TResult] t) [0x00016] in /Users/runner/runners/2.165.0/work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/AndroidDevice.cs:753
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: at System.Threading.Tasks.ContinuationTaskFromResultTask`1[TAntecedentResult].InnerInvoke () [0x00024] in <f9d1b832704f410aa8ec771f4fe80552>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: at System.Threading.Tasks.Task.Execute () [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-10/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2319
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: --- End of stack trace from previous location where exception was thrown ---
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: at AndroidDeviceExtensions.PushAndInstallPackage (Mono.AndroidTools.AndroidDevice device, System.String apkFile, System.String packageName, System.Boolean reinstall, Mono.AndroidTools.Adb.AdbProgressReporter notifyProgress, System.Threading.CancellationToken token) [0x00189] in /Users/runner/runners/2.165.0/work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Devices/AndroidDeviceExtensions.cs:187
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: at AndroidDeviceExtensions.PushAndInstallPackage (Mono.AndroidTools.AndroidDevice device, System.String apkFile, System.String packageName, System.Boolean reinstall, Mono.AndroidTools.Adb.AdbProgressReporter notifyProgress, System.Threading.CancellationToken token) [0x003df] in /Users/runner/runners/2.165.0/work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Devices/AndroidDeviceExtensions.cs:203
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: at Xamarin.AndroidTools.AndroidDeploySession.InstallPackage () [0x003be] in /Users/runner/runners/2.165.0/work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Sessions/AndroidDeploySession.cs:433
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: at Xamarin.AndroidTools.AndroidDeploySession.RunAsync (System.Threading.CancellationToken token) [0x003ae] in /Users/runner/runners/2.165.0/work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Sessions/AndroidDeploySession.cs:217
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(612,2): error ADB0010: at Xamarin.AndroidTools.AndroidDeploySession.RunLoggedAsync (System.Threading.CancellationToken token) [0x0002f] in /Users/runner/runners/2.165.0/work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Sessions/AndroidDeploySession.cs:119
Not a Xamarin expert but if you can see the native files, can you check gradle.properties if it has:
android.useAndroidX=true
android.enableJetifier=true
Also inside the build.gradle of the native files (app directory) you should have:
implementation "androidx.appcompat:appcompat:1.1.0"
Unfortunately the I wasn't able to make it work with DEX Compiler = DX, and when you switch to D8, the migration to AndroidX is required. In terms of Xamarin, you have to add the following package and all additional requested dependencies:
<PackageReference Include="Xamarin.AndroidX.AppCompat">
<Version>1.1.0</Version>
</PackageReference>
Another issue I hit was the usage of old packages.config file which have to be migrated to the project PackageReference. This is not supported from Visual Studio for Mac so you have to switch to Windows to accomplish that tasks. A lot of extra steps just to compile an application in support.
When I build my Xamarin Android app with Visual Studio 2017 for Mac(7.7.4 build 1), Mono JIT compiler version 5.18.0.248 (2018-08/a4956c837e1 Fri Jan 25 16:13:12 EST 2019) I get the following exceptions:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: The "ConvertResourcesCases" task failed unexpectedly.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: System.IO.IOException: Could not create file "/Users/username/Companymobil/src/Company.Recipes.Droid/obj/Debug/lp/35/jl/res/values-ca/values-ca.xml" or "/var/folders/b5/821mhz8n0px17rnxglrjq5mc0000gp/T/tmp565e9644.tmp". File already exists.
/var/folders/b5/821mhz8n0px17rnxglrjq5mc0000gp/T/
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at System.IO.File.Copy (System.String sourceFileName, System.String destFileName, System.Boolean overwrite) [0x00193] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/File.cs:111
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at Xamarin.Android.Tasks.ConvertResourcesCases.FixupResources (Microsoft.Build.Framework.ITaskItem item, System.Collections.Generic.Dictionary`2[TKey,TValue] acwMap) [0x00204] in <78f051a6e2064f849cc3ee585300af39>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at Xamarin.Android.Tasks.ConvertResourcesCases.FixupResources (System.Collections.Generic.Dictionary`2[TKey,TValue] acwMap) [0x0000f] in <78f051a6e2064f849cc3ee585300af39>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at Xamarin.Android.Tasks.ConvertResourcesCases.Execute () [0x000a7] in <78f051a6e2064f849cc3ee585300af39>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00023] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs:573
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x001f6] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs:784
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: The "ConvertResourcesCases" task failed unexpectedly.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: System.IO.IOException: Could not create file "/Users/username/Companymobil/src/Company.ServerAnnouncement.Droid/obj/Debug/lp/15/jl/res/layout/notification_template_icon_group.xml" or "/var/folders/b5/821mhz8n0px17rnxglrjq5mc0000gp/T/tmp4d4475a7.tmp". File already exists.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at System.IO.File.Copy (System.String sourceFileName, System.String destFileName, System.Boolean overwrite) [0x00193] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/File.cs:111
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at Xamarin.Android.Tasks.ConvertResourcesCases.FixupResources (Microsoft.Build.Framework.ITaskItem item, System.Collections.Generic.Dictionary`2[TKey,TValue] acwMap) [0x00204] in <78f051a6e2064f849cc3ee585300af39>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at Xamarin.Android.Tasks.ConvertResourcesCases.FixupResources (System.Collections.Generic.Dictionary`2[TKey,TValue] acwMap) [0x0000f] in <78f051a6e2064f849cc3ee585300af39>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at Xamarin.Android.Tasks.ConvertResourcesCases.Execute () [0x000a7] in <78f051a6e2064f849cc3ee585300af39>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00023] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs:573
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x001f6] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs:784
If I click on Build (NOT Rebuild) those exceptions get less every time I build until it finally builds successfully.
If I use jetbrains Rider, the build works every single time.
I gave full permissions (r/w) to everyone on the directories mentioned in the exception and I still get the error. I use APFS case-insensitive.
I would be very grateful for any pointer to solve this.
Thank you very much Leon Lu from Microsoft for pointing me in the right direction. The error stems from a condition in parallel building xamarin android. When parallel builds are disabled, the outcome is the same each time. Parallel builds can be disabled in the Preferences of Visual Studio 2017 for Mac (see attached image).
The issue seems to be fixed (see GitHub link in Leon Lu's comment) and be rolling out in one of the future updates.