Android App bundle Cannot find symbol variable for resource - android

I am trying to access the resource which is in base.apk, As documented I am placing all common source and resource in base app. But when I try to access the same from dynamic-module its giving error: cannot find symbol variable <resource>
What I have noticed is the R package in the dynamic module is different than the base app. But the IDE is not complaining anything.
Appreciate if anyone can help with this issue.
Thanks.

You may try to remove the R import statement generated in the dynamic module and use the same as in the App module.

You'll have to explicitly import the R file for the module you're requesting the resource from. For Kotlin I use import aliases like this:
import foo.bar.base.R as Rbase
So instead of foo.bar.base.R.dimen.bar_foo_size I can write Rbase.dimen.bar_foo_size. This also makes it fairly explicit to see where a resource is coming from compared to having to look into the imports.

Related

Error "Unresolved reference: _root_ide_package_" after changing the package name

When I changed my package name and rebuilt the project, Android Studio put before many class names this string _root_ide_package_.com.example.<myprojectname>. And I have this error Unresolved reference: _root_ide_package_. Any ideas how to fix it?
While posting a code example would help, I had a similar issue and resolved it by doing a Replace in Path across the source tree and replaced all instances of _root_ide_package_.com.example.<myprojectname>. with nothing.
Just remove anything before the class name, for example:
_root_ide_package_.com.<project_name>.APP
Remove _root_ide_package_.com.<project_name>.

How to fix "No resource found that matches the given name (at 'value' with value '#integer/google_play_services_version')"

I am getting the following error when I build my Android App project in Visual studio 2015.
No resource found that matches the given name (at 'value' with value '#integer/google_play_services_version')
These lines are located under:
obj\Debug\android\manifest\AndroidManifest.xml
There is 3 entires of it inside the AndroidManifest file.
I have downloaded the google play service from the SDK Manager.
Should I reference anything to my solution?
I already has Xamarin.GooglePlayServices.Base, Xamarin.GooglePlayServices.Basement, Xamarin.GooglePlayServices.Maps Referenced.
Thanks.
you have create integer.xml file inside value folder and define your Integer to that place it will solve your problem.
Try doing and a clean all and check that ALL the content under the obj has been deleted and then perform a build all.
If that does not work:
I would try removing the ~GooglePlayServices~ nugets/references and re-add just the Xamarin.GooglePlayServices.Mapsnuget which will bring in the ~Basement and ~Base libraries.
You should end up with a generated manifest that only has one reference to google_play_services_version and that resource should be picked up from Debug/android/XXX/YYYYYY/ZZZZZ/R.java:
i.e.
public static final int google_play_services_version=0x7f070000;
I added several new packages. One of the package is the reason of the error. I have to check one by one and caught the one causing error. Removing that package is all I need to do to resolve the error.

android:targetPackage cannot resolve symbol

this might seem trivial but I can't understand why I'm getting this error.
I downloaded the sample app activityInstrumentation( from Android Studio File -> import Sample) and inside the testing project manifest I get an unresolved symbol for
android:targetPackage="com.example.android.activityinstrumentation".
After that I've created a manifest for my application and still there is an unresolved symbol on the attribute.
My application project dir and test project dir are:
app/src/main/java/com/example/appname
where manifest has
package="com.example.appname"
app/src/androidTest/java/com/example/appname
where manifest has
<manifest
...
package="com.example.appname.tests"
...
android:targetPackage="com.example.appname"
...
</manifest>
Please help me sort this out. I don't know what else I can do: using a sample app to create a full fledged test project was my very last hope.
You must specify android:targetPackage in instrumentation tag.
[http://developer.android.com/guide/topics/manifest/instrumentation-element.html
]
I see the same thing. Seems to be only false alert produced by the lint code inspection. When you run analysis (Analyze->Inspect code...) and open "Inspection" tab you can select the warning and mark it Suppress for tag. That will get rid of the warning.

The type 'System.ComponentModel.INotifyPropertyChanged' is defined in an assembly that is not referenced

I get the following errors for the same file: LocationToLatLngValueConverter.cs
Reference:
https://github.com/MvvmCross/NPlus1DaysOfMvvmCross/tree/master/N-41-Maps
The type `System.ComponentModel.INotifyPropertyChanged` is defined in an assembly that is not referenced. You must add a reference to assembly `System.ObjectModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a`.
`D:\MVVMCross\MVVMCrossApps\MAP\Map\Map.Droid\Views\LocationToLatLngValueConverter.cs`
`Map.Droid.Views.LocationToLatLngValueConverter.Convert(Map.Core.ViewModels.Location, System.Type, object, System.Globalization.CultureInfo)': no suitable method found to override`
`D:\MVVMCross\MVVMCrossApps\MAP\Map\Map.Droid\Views\LocationToLatLngValueConverter.cs`
`Map.Droid.Views.LocationToLatLngValueConverter.ConvertBack(Android.Gms.Maps.Model.LatLng, System.Type, object, System.Globalization.CultureInfo)': no suitable method found to override D:\MVVMCross\MVVMCrossApps\MAP\Map\Map.Droid\Views\LocationToLatLngValueConverter.cs`
According to the demo everything of the application is provided.
I am still unable to get rid of the problems.
I just had this error in a Unit Test project referencing a PCL.
It was complaining that I hadn't referenced System.Object. The problem seemed to have been due to me referencing System.Runtime - Resharper seems to want to add it.
Removing the reference to System.Runtime fixed the issue for me.
I have looked into the code, and there is actually nothing wrong with that converter. The reason it is failing is that you have references to System.ObjectModel and System.Runtime that point to wrong versions of those classes. You can see that because there is a "red X" behind their names in Xamarin studio.
Also very specific versions of .net and other packages are referenced, which is not advised for normal purposes.
I managed to solve this issue by removing all using statements at the beginning of the file and then adding them back one by one.
Resharper eventually suggested me to reference System.ObjectModel

Error NullPointerException when running an altered version of an Android Project

I have this Android program running well, called TestePHP2 (name of main class), package com.testedeacesso.www. It is stable and runs perfectly.
I've cloned this project's folder to start developing an upgrade to it. I called it TesteTempo01, after importing it to Eclipse - option 'from existing project' (yes, I used the refractor to change the class name and I checked 'update references'). I modified this program's main class as I mentioned before and added some code to it, but I kept the package name the same, as well as other classes from the program.
Whe I try to run this program, though, I got a 'can't find main activity' error. After searching through my code, I found out that on the manifest there was a reference to the TestePHP2 that I hadn't changed before. for reference, this was the line on the Android Manifest XML:
> <activity android:name="com.testedeacesso2.www.TesteTempo01"
> android:label="#string/app_name">
After this, I keep getting a NullPointerException because the class can't find the main class! I've searched through the whole code but I found no other references to the old class. Have I forgotten something? Do I need to alter something else to change this class' name? Or the import will only work with the original class names?
You said the package was 'com.testedeacesso.www', but when you reference the class, its 'com.testedeacesso2.www'. I'm guessing you have a problem with class/package references.

Categories

Resources