I would like to pass along an array of bundles to FirebaseAnalytics as described here but FirebaseAnalytics.Param does not contain an ITEMS value. In fact, it only seems to contain a subset of the values it should contain as shown here:
I have firebaseanalytics version 17.4.4 and I tried to fill in the Param.ITEMS constant value myself ("items" according to the docs) but DebugView shows a firebase error (20 - Event array parameter name is invalid). All other events and parameters seem to work just fine according to DebugView and I found nobody with similar problems. Does anyone have any ideas as to why I only see a subset of the parameters?
Make sure you perform a Gradle sync, as FirebaseAnalytics.Param.ITEMS is definitely available in v17.4.4.
Here it is in my project, note the version number in the bottom right:
If you're still having trouble, mouseover one of the options in your dropdown and it should show you the version being used.
When I use the option "Build APK" in Android Studio 2.3.3 it generates a debug APK without issue, but when I try to generate a signed APK, an error appears:
Generate Signed APK: Errors while building APK. You can find the
errors in the 'Messages' view.
And in the 'Messages" view:
Error: Expected resource of type string [ResourceType]
It's doesn't seem to be a problem of the keystore or the signature, because it leads me to a line of the code, which is:
String color = getResources().getString(VarGlobales.color4).substring(3);
VarGlobales is just a class I created to define global variables, and of course it's imported correctly. VarGlobales.color4 is underlined, and when I hover, it says:
Expected resource of type string [less...] (Ctrl+F1) This inspection
looks at Android API calls that have been annotated with various
support annotations (such as RequiresPermission or UiThread) and flags
any calls that are not using the API correctly as specified by the
annotations. Examples of errors flagged by this inspection: Passing
the wrong type of resource integer (such as R.string) to an API that
expects a different type (such as R.dimen). Forgetting to invoke the
overridden method (via super) in methods that require it Calling a
method that requires a permission without having declared that
permission in the manifest Passing a resource color reference to a
method which expects an RGB integer value. ...and many more. For more
information, see the documentation at
http://developer.android.com/tools/debugging/annotations.html
VarGlobales.color4 is an Integer so, as far as I know, it should not give any error because getString() needs an Integer ID as a parameter. Doesn't the definition have the value I expected? It's like this:
// In VarGlobales class
public static int color4 = R.color.teal4;
R.color.teal4 was defined in colors.xml this way:
// In colors.xml
<color name="teal4">#00796B</color>
What's odd is that it doesn't give any error when building a debug APK so at first it shouldn't be a code problem.
I'm trying to bind an android SDK for voice chat (zoom sdk).
They have two .aar files (zoomcoomonlib.aar and zoomsdk.aar)
I know I have to create separate binding project for each .aar and then reference them.
While binding zoomsdk.aar I'm getting the below error
The type `Com.Zipow.Videobox.Onedrive.ErrorEventArgs' already contains a definition for `P0' (CS0102) (B14)
In the .aar file I navigated to the package com.zipow.videobox.onedrive; to the interface IODFoldLoaderListener
And below are the contents of it
So it seems parameter String var1 of method onError is causing the issue.
And xamarin studio generated obj/debug/api.xml confirms it (below screenshot) that onError will have first parameter named p0:
So in this scenario I change the metadata.xml to give this parameter a meaningful name.
Like below screenshot:
But even after doing that I am getting same error. That error didn't resolve.
Moreover now if I see the obj/debug/api/.xml file I see the contents for the class IODFoldLoaderListener remains the same.
So changing the metadata.xml has no effect it seems.
Your definition needs to be changed quite a bit. Here is an example that solves the same problem:
<attr path="/api/package[#name='com.emarsys.mobileengage.inbox']/interface[#name='ResetBadgeCountResultListener']/method[#name='onError' and count(parameter)=1 and parameter[1][#type='java.lang.Exception']]" name="argsType">ResetBadgeCountResultListenerOnErrorArgs</attr>
Please note the /interface and argsType items here as your initial definition is incorrect. You would then change the parameters to strings instead of java.lang.Exception from my example.
I am trying to develop an application that requires the ability to capture screen content. I'm targeting lollipop to avoid the requirement for root. When trying to get an instance of the MediaProjectionManager via a call to getSystemService() I am getting the following error reported in Android Studio:
Must be one of: Context.POWER_SERVICE, Context.WINDOW_SERVICE, Context.LAYOUT_INFLATER_SERVICE, Context.ACCOUNT_SERVICE, Context.ACTIVITY_SERVICE, Context.ALARM_SERVICE, Context.NOTIFICATION_SERVICE, Context.ACCESSIBILITY_SERVICE, Context.CAPTIONING_SERVICE, Context.KEYGUARD_SERVICE, Context.LOCATION_SERVICE, Context.SEARCH_SERVICE, Context.SENSOR_SERVICE, Context.STORAGE_SERVICE, Context.WALLPAPER_SERVICE, Context.VIBRATOR_SERVICE, Context.CONNECTIVITY_SERVICE, Context.WIFI_SERVICE, Context.WIFI_P2P_SERVICE, Context.NSD_SERVICE, Context.AUDIO_SERVICE, Context.MEDIA_ROUTER_SERVICE, Context.TELEPHONY_SERVICE, Context.CLIPBOARD_SERVICE, Context.INPUT_METHOD_SERVICE, Context.TEXT_SERVICES_MANAGER_SERVICE, Context.DROPBOX_SERVICE, Context.DEVICE_POLICY_SERVICE, Context.UI_MODE_SERVICE, Context.DOWNLOAD_SERVICE, Context.NFC_SERVICE, Context.BLUETOOTH_SERVICE, Context.USB_SERVICE, Context.INPUT_SERVICE, Context.DISPLAY_SERVICE, Context.USER_SERVICE, Context.PRINT_SERVICE less... (Ctrl+F1)
Reports two types of problems:
* Supplying the wrong type of resource identifier. For example, when calling Resources.getString(int id), you should be passing R.string.something, not R.drawable.something.
* Passing the wrong constant to a method which expects one of a specific set of constants. For example, when calling View#setLayoutDirection, the parameter must be android.view.View.LAYOUT_DIRECTION_LTR or android.view.View.LAYOUT_DIRECTION_RTL.
I am currently at a loss as to why this constant is not considered valid, it's there as an autocomplete option, so it's present, and it's shown in all sample code I have seen for screen capture in lollipop. I have verified that the project setup specifies Android SDK 21 as min and target. Is there something else obvious/stupid I might be missing that would cause this error?
UPDATE: Took the exact same code to Eclipse and it works without issue. So this is related to something in Android Studio specifically it seems.
I get this error while getting Context.BLUETOOTH_SERVICEand the error doc (Must be one of..) contains Context.BLUETOOTH_SERVICE though.
This is not the way Android Studio "1.2" should work. :#
Anyway, its an Inspection bug, Constant and Resource Type mismatch (How in the hell Bluetooth is a resource in android context).
You can suppress this for Class/Method/Statement, for statement, add #SuppressWarnings("ResourceType") above or before the statement.
Another approach:
Goto Settings>>Editor>>Inspection>>Android>>Constant and Resource Type Mismatches and make the severity to anything but Error, probably Warning or Weak Warning.
(Though it fixes the error issue, but I want this mismatch to be an error when it really happens.)
Run into the same problem, it is so strange, there are no any other threads talking about this problem.
Well, actually you can just ignore this error and still run the program, even with
the red marks on it
If I understand the documentation correctly, a call to Resources.getIdentifier() returns 0 in case the resource with name doesn't exist. An emulator with API level 8 works that way.
However, if I use an emulator with API level 16 it creates a new id for me. I can even call Resources.getResourceName() on it to get the name I used in Resources.getIdentifier(). If I call Resources.getString() it throws an exception.
int resourceId;
// both calls return the same value:
resourceId = resources.getIdentifier("com.testthisout:string/idontexist", null, null);
resourceId = resources.getIdentifier("idontexist", "string", "com.testthisout");
// with API-level 8 resourceId is 0.
// with API-level 16 it's something like 0x7f07005f now.
resources.getResourceName(resourceId); // returns "com.testthisout:string/idontexist"
resources.getString(resourceId); // BANG!!!
android.content.res.Resources$NotFoundException: String resource ID #0x7f07005f
at android.content.res.Resources.getText(Resources.java:229)
at android.content.res.Resources.getString(Resources.java:313)
at android.content.res.Resources.getString(Resources.java:341)
<my method here, no nested exception or something>
Resources.getIdentifier() returns incrementing numbers for all further calls to it with non-existing resource names and apparently it stores them somewhere.
I've already created a fresh emulator from scratch and still have the same behaviour. I have tests with robolectric in a different project (that is linked into my main project just like their guide explains), but it doesn't help if I close that project (I thought that their shadowing mechanism somehow causes issues). Cleaning and rebuilding the project doesn't help, there is no warning or error.
I need this functionality as I'm working with generic resource names and some more logic in the background.
Is this behaviour expected? Is there something that I'm doing wrong?