Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Android.Indoor: No resource found (@style/AppTheme) #17

Open
MatthewGerber opened this issue Jan 3, 2019 · 5 comments
Open

Android.Indoor: No resource found (@style/AppTheme) #17

MatthewGerber opened this issue Jan 3, 2019 · 5 comments
Labels
native Resolution depends on the native SDK

Comments

@MatthewGerber
Copy link
Contributor

@heypiotr I just added the indoor location bindings for Android to my project, and when I recompiled I got an error pointing to an invalid AndroidManifest.xml file that had been added to the obj directory. Please see the attached screen shot:

screen shot 2019-01-03 at 2 14 48 pm

Do you have any ideas why this manifest is being added to the output? For example, was it accidentally included in the NuGet? Any other ideas?

@MatthewGerber
Copy link
Contributor Author

@heypiotr Some additional information: There are other AndroidManifest.xml files in the obj directory. The difference is that these other files do not include the <application android:theme="@style/AppTheme"></application> element, which is present in the above screenshot. I suspect, then, that you just need to remove this element from the package's AndroidManifest.xml file. Can you try this?

@MatthewGerber
Copy link
Contributor Author

MatthewGerber commented Jan 4, 2019

@heypiotr I was able to resolve the issue above by declaring a theme named AppTheme in my style.xml so as to match the one shown in the manifest above, which is generated for the bindings package. My style.xml now looks like this:

<resources>
  <style name="SensusTheme" parent="SensusTheme.Base">
  </style>
  <style name="SensusTheme.Base" parent="Theme.AppCompat.NoActionBar">    
  </style>
  <style name="AppTheme" parent="Theme.AppCompat.NoActionBar">    
  </style>
</resources>

This seems to work, but I am still wondering whether you could prevent this theme from appearing in the manifest. I've seen other packages that do not include such a theme.

Now I am encountering a new issue: The Proximity and Indoor binding NuGet packages include duplicate libraries (e.g., kotlin-stdlib), and our project uses both NuGets. Compiling gives the following error:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(3,3): Error: java.lang.IllegalArgumentException: already added :  Lkotlin/ArrayIntrinsicsKt;

The error appears to result from duplicate Kotlin types being included. You can reproduce this error by adding the Estimote Proximity NuGet to the Example.Android.Indoor project.

Any thoughts on how we can proceed such that both Proximity and Indoor NuGets can be included? For example, can we pull out the common JARs into a separate NuGet that is referenced from both Proximity and Indoor bindings?

@heypiotr
Copy link
Contributor

heypiotr commented Jan 4, 2019

I think I recall running into the same problem when building these bindings. I can see I have the same "solution" in my example app:

https://github.com/Estimote/Xamarin-Bindings/blob/master/ExampleApps/Example.Android.Indoor/Resources/values/Styles.xml#L3

… that is, I went ahead and defined the @style/AppTheme that the compiler says is missing.

It was a few months ago, but I think I concluded that the native Android Indoor SDK for some reason depends on this value—most likely by mistake. (And we never found out about this, because Android Studio generates this value by default. Whereas Visual Studio does not.)

The proper solution here would be to remove this from the native Android Indoor SDK, I'll see if we can do that.

(For comparison, my Android Proximity bindings example doesn't even have the styles.xml file: https://github.com/Estimote/Xamarin-Bindings/tree/master/ExampleApps/Example.Android.Proximity/Resources/values)

@MatthewGerber
Copy link
Contributor Author

@heypiotr That makes sense. Any thoughts on how we can support the inclusion of both Proximity and Indoor NuGets, per my other comments above? We do not intend to use them concurrently in the app at runtime, but we need to have the option to run one or the other.

@MatthewGerber
Copy link
Contributor Author

@heypiotr I believe I've figured this out. I'll post here in a bit with a potential solution.

@heypiotr heypiotr changed the title Estimote indoor location bindings for Android -- adds invalid AndroidManifest.xml to obj directory Android.Indoor: No resource found (@style/AppTheme) Apr 24, 2019
@heypiotr heypiotr added the native Resolution depends on the native SDK label Apr 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
native Resolution depends on the native SDK
Projects
None yet
Development

No branches or pull requests

2 participants