Laerdal / Xamarin.AzureCommunicationCalling

Xamarin iOS and Android binding libraries for Microsofts Azure Communication Services
MIT License
36 stars 11 forks source link

App Not Install using Android on Microsoft App Center #12

Closed willlimtc closed 3 years ago

willlimtc commented 3 years ago

Hi, first of all. Thank you for initiating this great project! I leveraged your project and tried to extend the capability on the Surface DUO device that has been made public just last year. I first cloned your github project and developed on visual studio 2019. Then I used the debug mode to run it my physical DUO, which is shown below. It works fine.

image

Then I try to build my demo on the Microsoft App Center, so that I can distribute the demo for other people to use. Since my DUO is andriod 10.0, I used chose the config below to build the app in the app center

image

However, it came with build error like this

2021-01-14T08:16:11.8442390Z UNEXPECTED TOP-LEVEL EXCEPTION: 2021-01-14T08:16:11.8442970Z java.lang.RuntimeException: Translation has been interrupted 2021-01-14T08:16:11.8445890Z at com.android.dx.command.dexer.Main.processAllFiles(Main.java:614) 2021-01-14T08:16:11.8446690Z at com.android.dx.command.dexer.Main.runMonoDex(Main.java:310) 2021-01-14T08:16:11.8448250Z at com.android.dx.command.dexer.Main.runDx(Main.java:288) 2021-01-14T08:16:11.8448910Z at com.android.dx.command.dexer.Main.main(Main.java:244) 2021-01-14T08:16:11.8449300Z at com.android.dx.command.Main.main(Main.java:95) 2021-01-14T08:16:11.8450150Z Caused by: java.lang.InterruptedException: Too many errors 2021-01-14T08:16:11.8451760Z at com.android.dx.command.dexer.Main.processAllFiles(Main.java:606) 2021-01-14T08:16:11.8452800Z ... 4 more 2021-01-14T08:16:11.9798610Z /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2732,3): error : java/lang/Exception;I)Z: defining a default interface method requires --min-sdk-version >= 24 (currently 13) for interface methods: com.azure.android.core.http.interceptor.RetryStrategy.shouldRetry : (Lokhttp3/Response;Ljava/lang/Exception;I)Z [/Users/runner/work/1/s/TestApp/AzureCommunicationVideoTest.Android/AzureCommunicationVideoTest.Android.csproj] 2021-01-14T08:16:12.0771280Z Done Building Project "/Users/runner/work/1/s/TestApp/AzureCommunicationVideoTest.Android/AzureCommunicationVideoTest.Android.csproj" (PackageForAndroid target(s)) -- FAILED. 2021-01-14T08:16:12.1065820Z 2021-01-14T08:16:12.1070570Z Build FAILED.

I then change the SDK version in the app center to both 11.1 and 10.3. The build was successful. However, when I try to install the build artifact .apk file on my DUO, it came with the annoying response of app not installed, without any detailed info.

I was wondering why installing the app on my DUO is not successful using apk generated by App center build, whereas installing directly thru visual studio debug was successful. Do you have any insights on this? Thank you!

tompi commented 3 years ago

Hmm, I havent tried distributing debug-builds through app-center. I would recommend building in release mode. If it doesnt work, try to build in release mode locally, if that doesnt work, post the build/runtime error logs afterwards. Might be some linking errors.

P.S. I take it the video works when you run it locally in debug? P.P.S. Your log is truncated, so I dont think it shows the actual error...

willlimtc commented 3 years ago

Thanks for the reply. Unfortunately, building in release mode doesn't work either on VS 2019 or the App-center. The error message in VS and app-center both look like this. It seems like linking errors. Do you have any insights?

Severity Code Description Project File Line Suppression State Error Mono.Linker.MarkException: Error processing method: 'System.Void Com.Azure.Android.Core.Util.DateTimeRfc1123::.ctor(ThreeTen.BP.OffsetDateTime)' in assembly: 'Xamarin.AzureCore.Android.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve ThreeTen.BP.OffsetDateTime at Mono.Linker.Steps.MarkStep.HandleUnresolvedType(TypeReference reference) at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference) at MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference) at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method) at Mono.Linker.Steps.MarkStep.ProcessQueue() --- End of inner exception stack trace --- at Mono.Linker.Steps.MarkStep.ProcessQueue() at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue() at Mono.Linker.Steps.MarkStep.Process() at Mono.Linker.Steps.MarkStep.Process(LinkContext context) at MonoDroid.Tuner.MonoDroidMarkStep.Process(LinkContext context) at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step) at Mono.Linker.Pipeline.Process(LinkContext context) at MonoDroid.Tuner.Linker.Process(LinkerOptions options, ILogger logger, LinkContext& context) at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res) at Xamarin.Android.Tasks.LinkAssemblies.RunTask() at Xamarin.Android.Tasks.AndroidTask.Execute() AzureCommunicationVideoTest.Android

tompi commented 3 years ago

@willlimtc Could you check your android version settings, there are 3 of them, I use 10 for "General -> Compile using" and "Android Application -> Target version" and 8 for "Android application -> Minimum version"

Also, maybe, just to test, you could change "linker behaviour" in your build setup. Im assuming its set to "link all assemblies"? Does it work if you set this do "do not link"?

Also worth trying: Check your "code shrinker"-options for release mode build, does it work if you select "nothing" here?

One more thing: sometimes you get the "not installed" message if you try to install VSAppcenter app "over" an existing debug/prod version on your device. Could you try uninstalling the local app, and THEN install it from Visual Studio Appcenter(Im assuming thats what you are using to distribute APKs?).

willlimtc commented 3 years ago

Hi Thomas, Thanks for the reply. Just to make sure I find the right place to do the setting adjustment. 1 The android version settings, I found the target version and minimum version setting in the android manifest tab as shown below. Is it the right place to set for 10 and 8? I didn't find general->Compile using. Do you know where to find this setting? image

2 For the linker behavior to do not link, is it in the Android Options tab (Linking set to non) as shown below? And the code shrinker option is to set the code shrinker to nothing as shown below?

image

3 For the install process. I first uninstalled the hotloaded app thru VS debug and then upload the built apk file from App center to google drive and installed from the google drive. I didn't use the APP center to DISTRIBUTE the app. It's worth note that I also use the achieve manager in VS studio to generate the apk file and it failed with the same Error Mono.Linker.MarkException I showed in the previous post. I think that's the core issue. Is there anyway to fix it?

Thanks again!

Will

tompi commented 3 years ago

@willlimtc I would think if you set "linking" to "none", that you would avoid the problem(at the cost of a much bigger apk...)

tompi commented 3 years ago

P.S. I see you use VS on windows, havent tried that for a very long time... On mac its right click project then options to get here: Screenshot 2021-01-15 at 15 11 20

willlimtc commented 3 years ago

Hi Thomas,

I made the suggested changes and it is now successfully released. Thank you so much for your help!

Will