My application was originally written using Delphi v10.2.2 and TBannerAd worked just fine.
Without any code changes and after upgrading Delphi to v10.2.3 (by installing over the existing v10.2.2 using the ISO without changing anything in the installation dialogs), calling TBannerAd's "LoadAd" method started triggering this exception:
Project myproject.apk raised exception class EJNIException with message
'java.lang.IllegalStateException: The meta-data tag in your app's
AndroidManifest.xml does not have the right value. Expected 4323000
but found 7095000. You must have the following declaration within the
< application > element: < meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" / >'.
I reviewed the AndroidManifest.xml file and indeed the "7095000" value is used, but I don't know why/how delphi uses this value. Rebuilding the project generates a new AndroidManifest.xml file with the "7095000" value, so I can't directly edit the XML file as a work-around.
What causes this? Is it some setting or SDK path that changed due to the upgrade? (I tried searching but couldn't find anything relevant)
Things I tried:
Completely uninstalling the application and running it again from Delphi (on a real device, a Galaxy note 4).
Under options, changing the NDK API location and C++ Builder NSK Library paths from "\platforms\android-14" to "\platforms\android-19".
Tokyo 10.2.3 has updated Google Play Services and its libraries.
Applications created with old version don't automatically update the libraries to new ones shipped with 10.2.3 release.
To update the libraries go to Project Manager -> Android -> Android SDK xxx -> Libraries and select "Revert System Files to Default" from the popup menu.
After reverting list of included libraries should be
Related
Rendering Problems
"high_quality" in attribute "breakStrategy" is not a valid integer
([N] similar errors not shown)
Tip: Try to refresh the layout.
([N] is a variable number.)
This message was produced after I restarted Android Studio, for all activities and any other design-able files (such xml/pref_XXX.xml files)!
I searched all project files (Ctrl+Shift+F) for "high_quality" and "breakStrategy" but found nothing!
The interesting note is no problem in designing! Just show this message.
Also, I tried Clean Project, Rebuild Project, Synchronize (Ctrl+Alt+Y), Synchronize app, pressing the refresh hyperlink inside the mentioned message, restarting Android Studio again, ... But no avail!
I have updated the android sdk build-tools, platfom-tools, API 25 and works.
When uploading an APK to the Android Developer Console, everything goes normal, but there are a certain subset of users on android 5.0 and up that are unable to install or upgrade the APK. These users see a Google Play Store error 505.
There are several different resources that tell you that the 505 error is a conflict of permission. Starting in Android Lollipop, you are no longer able to have duplicate custom permissions with the same name https://developer.android.com/about/versions/android-5.0-changes.html#custom_permissions. If you check stackoverflow for this error you'll find multiple reports of people offering this as a solution. While this can sometimes be the cause of this error there are several other reasons that this, and other conflicts can happen.
1. More than one app defines the same permission
If two completely different apps define the same permission e.g if you have a user and a manager app, and both of them have something along the lines of:
<permission
android:name="same.package.name.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
2. Same app signed by different keys
You have the same app, but signed by different keys. For example if you had a release version and a debug version, you'll hit a conflict because the system sees this as two different apps requesting the same permission.
3. Conflicting authorities
But there is an entirely different situation that can occur, which is less obvious. The 505 error can also occur with conflicting authorities. If two different apps declare the same provider, such as
<provider
android:name=".provider.YourProvider"
android:authorities="com.roqbot.client.YourProvider"
android:exported="false" />
This can also provide a conflict.
The last, and hardest conflict to spot, is one that can happen with Google Play Services 8.1 and up. If you do not define an application id in your build.gradle file like this:
defaultConfig {
applicationId "com.example.my.app"
}
it is possible that it will auto-generate a provider that can conflict with other apps. To check this, go into your your build>intermediates>manifests>full>release>AndroidManifest.xml and look for
<provider
android:name="com.google.android.gms.measurement.AppMeasurementContentProvider"
android:authorities="com.google.android.gms.google_measurement_service"
android:exported="false" />
Here the authority name will conflict with other apps. If you add the applicationId to the default config, it will change this authority to
<provider
android:name="com.google.android.gms.measurement.AppMeasurementContentProvider"
android:authorities="com.example.my.app.google_measurement_service"
android:exported="false" />
This is very subtle and appears to be a bug starting in google play services 8.1. The issue can be seen discussed here. https://code.google.com/p/android/issues/detail?id=189079&can=1&q=error%20505&sort=-opened&colspec=ID%20Status%20Priority%20Owner%20Summary%20Stars%20Reporter%20Opened
The point to remember is that it may be several things, and the only thing you can verify for sure with a 505 error is that there is a conflict of some sort, and that it may or may not necessarily be a custom permission conflict.
If you are using the Facebook SDK and following the official sample code, you might also encounter the issue. In my case, I was using a same content provider name on 2 different app's manifest.
<provider
android:authorities="com.facebook.app.FacebookContentProvider123"
android:name="com.facebook.FacebookContentProvider"
android:exported="true" />
I forgot to change the default name com.facebook.app.FacebookContentProvider123. Finally fixed it by adding a dynamic applicationId as provider name.
<provider
android:authorities="com.facebook.app.FacebookContentProvider.${applicationId}"
android:name="com.facebook.FacebookContentProvider"
android:exported="true" />
Name Of The Error: Error 505
Problem: This is an unusual error code which is encountered during the updation or installation of the application from Google Play store. It shows up an error message stating “Unknown error code during Application installs 505”.
Following reasons are responsible for this error.
• It is mostly seen when you try to install an outdated version of the app.
• Error 505 can be caused due to the incompatibility of the app with your Android OS version.
• It can also arise due to cache conflict or data crash of the app.
• Error 505 may also arise due to Google Account Sync Problem.
Solution:
• At first restart your Android device, because this step usually works in getting rid off of any type of error. If it didn’t work and then try these simple steps.
• Clear Cache and Data of Google Play Store, Google Service Framework and Download Manager. To do this First of all go to Settings >> then Apps >> select All >> then Google Play Store and Clear cache and Clear data. Also Clear cache and Clear data for Google Services.
So I want to build an extensible android application where developers can add 'CustomDevice' classes and the main program will run them automatically without editing existing code.
I've read about Service Provider interface and thought that would be a nice way to go about it.
So I tested it and created an interface called 'ICustomDevice' which custom device classes are expected to implement.
I've created a class called 'DummyDevice' that implements ICustomDevice.
Both DummyDevice and ICustomDevice are in the same package "CustomDevicePackage".
So in my main program I run the following.
ServiceLoader<ICustomDevice> loader = ServiceLoader.load(ICustomDevice.class);
Iterator<ICustomDevice> devices = loader.iterator();
System.out.println("Does it have devices? " + devices.hasNext());
It always returns false, which means it's not finding the 'DummyDevice'
In my eclipse project I created a folder at 'src' called META-INF and under it, a subfolder called 'services'.
'Services' has a file named 'CustomDevicePackage.ICustomDevice' with a line of content 'CustomDevicePackage.DummyDevice'.
Am I doing it right? Every example I see about SPI is about loading JARS.
I'm not loading a JAR, I'm trying to run a class in the same Project. Does this method only works for loading JARs? I want my program to support loading local subclasses and external JARs alike.
I am adding this as an answer but leaving the prior "answer" to provide extended code detail for this workaround. I am working on reporting the prior answer results as a bug to Google.
Because the Android implementation of java.util.ServiceLoader is broken (always populating internal java.security.AccessControlContext field with AccessController.getContext() even if System.getSecurityManager() == null), the workaround is to create your own ServiceLoader class by copying the code found at OpenJDK for Java 8 into your class, add specific imports required from java.util without using import java.util.*;, and call that ServiceLoader in your code (you will have to fully reference the ServiceLoader you created to over ambiguity).
This isn't elegant but it is a functional workaround that works! Also, you will need to use a ClassLoader in your ServiceLoader.load() call. That ClassLoader will either have to be YourClass.class.getClassLoader() or a child ClassLoader of the class' ClassLoader.
Though it's an old post, This may be still be of some help to others:
When I was running or debugging a project that contained a ServiceLoader Class, I had to put the META-INF/services folder into the src/ folder in Eclipse.
If I tried to export the project as Runnable jar and tried to use the class with the service loader, it never worked.
When I checked the jar, unzipping it, I found the folder under src/META-INF/services though.
Only when I also added the META-INF folder directly in the root directory of the jar, it started to work.
I haven't found a fix though inside Eclipse, that makes sure it gets exported right...maybe an ANT script can solve this issue, but so far no attempts made...
This is an answer:
At some point, Android removed the AccessControlContext field in ServiceLoader and ServiceLoader now works. As my comments indicate, this was reproduceable using the "out-of-the-box" OREO (API 26) Intel Atom x86 emulator with Android Studio (also fresh download). 24 hours later, ServiceLoader no longer contained the acc field (as shown in the Android Studio debugger with the same emulator). The Android SDKs dating back to API 24 do not show the acc field.
Per the Android developer currently maintaining the ServiceLoader code:
He is not aware of ServiceLoader ever having the acc field in Android (it did as we were able to reproduce) and thought the debugger/emulator might have been using JDK code (but I showed the OpenJDK code works correctly). Somewhere along the way, the errant code was updated and I am no longer able to reproduce.
Be sure your OS is up-to-date and you should no longer see this phenomena.
I tried to upgrade my implementation of AdMob. Using the GoogleAdMobSDK, I would like to turn into the google-play-services-lib.
The ad appears. So it seems ok, but I still got this error at the method call loadAd() in log
Requesting resource 0x7f0c000d failed because it is complex
GooglePlayServicesUtil: The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
Here's my checklist:
I import the library project in my workspace, copying the source.
I reference the library into my project
I add the meta-data in the Manifest
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
My code
this.request = new AdRequest.Builder().addTestDevice(id).build();
this.adView = new AdView(context);
this.adView.setAdUnitId(MY_AD_UNIT_ID);
this.adView.setAdSize(AdSize.SMART_BANNER);
...
this.adView.loadAd(request);
The target version for my app in 9 (2.3). I test on Nexus 5 with KitKat version.
I also tried to put the google-play-services-lib jar in the properties, but no result.
I want to be sure that this error could be handle before submit my app.
This is a benign error with the current version of Google Play Services.
Don't worry about it. Submit your app. Get some sleep.
So a few days ago I got my hands on an Arduino Mega ADK board, and the last couple of nights I have been setting up my development environment, getting to grips with the tools etc. The tools and libraries all work fine, for example I can get a program written in the Processing IDE to compile and run on an Asus Eee Pad Transformer TF101 running Android 4.03. But when I get it to try to compile and run one of the pre-written examples, it gives me a compiler error:
Android SDK Tools Revision 20
Installed at C:\NVPACK\android-sdk-windows
Project Type: Application
Project Target: Android 2.3.3
API level: 10
Library dependencies:
No Libraries
API<=15: Adding annotations.jar to the classpath.
Merging AndroidManifest files into one.
Manifest merger disabled. Using project manifest only.
No AIDL files to compile.
No RenderScript files to compile.
Generating resource IDs...
Generating BuildConfig class.
BUILD FAILED
C:\NVPACK\android-sdk-windows\tools\ant\build.xml:680: The following error occurred while executing this line:
C:\NVPACK\android-sdk-windows\tools\ant\build.xml:693: Compile failed; see the compiler error output for details.
Total time: 7 seconds
And that's all the console seems to output as well, which is rather frustrating! As far as I'm aware all of my SDK versions, tools and plugins are all up to date. I've tried this using a Linux partition I have on my hard drive and it produces the same error message, although it mentions a problem with the package com.Android.future.UsbAccessory. Given what I've seen, it seems that the problem is with the tools, either my directory structure doesn't match up to what the correct setup is, or something else is wrong :S. If anyone has had similar problems, some help would be smashing! (For the record, my setup was done using the instructions on the Arduino website, although I already had the Android SDK tools installed).
Will Scott-Jackson
It sounds like your haven't added in the support library to your project and/or you haven't downloaded it into your Android SDK.
The ADK1 demokit app targets API Level 10 (Android 2.3.3); That means you need to use the support libraries in your project and that's why the compiler is complaining about level 10 library dependencies not being available. The support libraries are a separate download in the SDK Manager, so you might not have them in your development environment.
In Android API Level 12 and higher, the USB Accessory protocol was added to the framework API, so there are two different ways to use the accessory protocol. So, you don't have to use the support libraries if you are targeting Honeycomb and higher versions, but you'll have to update the demokit app code to make this work.
Hope this helps.
So I've double checked my setup and started working on a project I had in mind, it seems to import the libraries appropriately. So far so good, but when I input:
ArduinoAdkUsb arduino;
void setup() {
arduino = new ArduinoAdkUsb(this);
//Other UI initialisation etc.
}
I get this error:
##name## ##version## by ##author##
FATAL EXCEPTION: Animation Thread
java.lang.NoClassDefFoundError: com.android.future.usb.UsbManager
at cc.arduino.ADKCommunication.<init>(Unknown Source)
at cc.arduino.ArduinoAdkUsb.<init>(Unknown Source)
at
processing.android.test.sketch_120730a.
sketch_120730a.setup(sketch_120730a.java:48)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PGraphicsAndroid2D.requestDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:856)
After the app has been built and installed onto the Android tablet I am using. Any thoughts how I can over come this? From what I can tell, this has no problem finding com.android.future.usb.manager to compile and install the program, but once it tries to run it can find it.
Based on this tutorial from http://stream.tellart.com/controlling-arduino-with-android/
In the examples RGB_Arduino the name, version and author variables are set at the top of the sketch.
Try adding in this section of code at the top of your arduino sketch just underneath the library imports
// accessory descriptor. It's how Arduino identifies itself to Android
char applicationName[] = "Mega_ADK"; // the app on your phone
char accessoryName[] = "Mega_ADK"; // your Arduino board
char companyName[] = "Freeware";
// make up anything you want for these
char versionNumber[] = "1.0";
char serialNumber[] = "1";
char url[] = "http://labs.arduino.cc/adk/"; // the URL of your app online
//initialize the accessory:
AndroidAccessory usb(companyName, applicationName,
accessoryName,versionNumber,url,serialNumber);