Migrated application from 6.2 to 7.0. Server MobileFirst version: 7.0.0.00.20150312-0731
The application itself works great. When push new wlapp to server, the device see's update is available. Proceed to install update and fails.
logCat
W/PluginManager(11315): THREAD WARNING: exec() call to WLDirectUpdatePlugin.start blocked the main thread for 20ms. Plugin should use CordovaInterface.getThreadPool().
W/HardwareRenderer(11315): Attempting to initialize hardware acceleration outside of the main thread, aborting
W/PluginManager(11315): THREAD WARNING: exec() call to WLDirectUpdatePlugin.showProgressDialog blocked the main thread for 44ms. Plugin should use CordovaInterface.getThreadPool().
E/com.worklight.androidgap.directupdate.WLDirectUpdateDownloader( 9466): WLDirectUpdateDownloader.validateZipFileIntegrity in WLDirectUpdateDownloader.java:129 :: Invalid direct update zip file, original file might have been altered or replaced.
7.0.0.00.20150312-0731 is an awfully old build of MFPF 7.0; many fixes, including to Direct Update took place since.
I suggest that you will update to latest available iFix from IBM Fix Central to confirm this issue still happens to you.
This is an issue in which the content type of returned direct update zip is not "application/zip" as it should be.
Note that Worklight server returns "application/zip" content type for android direct update. We have a test fix right now where we just log the different content type and continue the direct update process since it can be correct zip and content type can be changed by firewall for example.
If you create a PMR, we can give you a test fix to test (just drop worklight-android.jar into Android project -> deploy onto device). Once we confirm that it works we can deliver it to production builds. When submitting the PMR please link them to this StackOverflow question to give full background of issue.
Related
Currently trying to build android-5.1.0_r5. I've checked out the sources and made no modifications. However, when compiling I get the following error.
Checking API: checkpublicapi-current
out/target/common/obj/PACKAGING/public_api.txt:20: error 5: Added public field android.Manifest.permission.BACKUP
out/target/common/obj/PACKAGING/public_api.txt:82: error 5: Added public field android.Manifest.permission.INVOKE_CARRIER_SETUP
out/target/common/obj/PACKAGING/public_api.txt:106: error 5: Added public field android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE
out/target/common/obj/PACKAGING/public_api.txt:116: error 5: Added public field android.Manifest.permission.RECEIVE_EMERGENCY_BROADCAST
******************************
You have tried to change the API from what has been previously approved.
To make these errors go away, you have two choices:
1) You can add "#hide" javadoc comments to the methods, etc. listed in the
errors above.
2) You can update current.txt by executing the following command:
make update-api
To submit the revised current.txt to the main Android repository,
you will need approval.
******************************
And diffing the public api txt files does indeed show a difference.
diff frameworks/base/api/current.txt out/target/common/obj/PACKAGING/public_api.txt
19a20
> field public static final java.lang.String BACKUP = "android.permission.BACKUP";
80a82
> field public static final java.lang.String INVOKE_CARRIER_SETUP = "android.permission.INVOKE_CARRIER_SETUP";
103a106
> field public static final java.lang.String READ_PRIVILEGED_PHONE_STATE = "android.permission.READ_PRIVILEGED_PHONE_STATE";
112a116
> field public static final java.lang.String RECEIVE_EMERGENCY_BROADCAST = "android.permission.RECEIVE_EMERGENCY_BROADCAST";
However, I cant figure out where those additional Public Fields are coming from. Any ideas?
Don't do 'make update-api' if you didn't touch anything. There additional apis came form frameworks/base/res/AndroidManifest.xml badly parsed by aapt that uses buggy system/core/libcore/String8.cpp##removeAll() they use memcpy but should be memmove for overlapping strings in memory.
This is issue on latest Debian (sid) or Ubuntu (16 maybe 15) build machines.
It's a google bug in libcore/String8.cpp. Fix is here:
https://android.googlesource.com/platform/system/core/+/dd060f01f68ee0e633e9cae24c4e565cda2032bd
This man found it (Michael Scott) and maybe some other people too. Here is his investigation: https://plus.google.com/+hashcode0f/posts/URHo3hBmfHY
Living on the Edge (of Ubuntu) ... can be painful!
I've been running Ubuntu 15.04 for a while now. It's been great
having a very current kernel alongside the latest improvements from
Ubuntu and Debian. (My past post on using zRAM ramdisk is one
example).
However, having the newest greatest toys also has it's downsides. I
recently spent 4 days troubleshooting a build break in Android which
started some time after March 25th. I'm guessing I updated packages
or inadvertently changed my glibc version.
The outcome was a build error during the checkapi stage of Android
build:
Install: /out/mydroid-ara/host/linux-x86/bin/apicheck Checking API:
checkpublicapi-last Checking API: checkpublicapi-current
/out/mydroid-ara/target/common/obj/PACKAGING/public_api.txt:20: error
5: Added public field android.Manifest.permission.BACKUP
/out/mydroid-ara/target/common/obj/PACKAGING/public_api.txt:82: error
5: Added public field android.Manifest.permission.INVOKE_CARRIER_SETUP
/out/mydroid-ara/target/common/obj/PACKAGING/public_api.txt:106: error
5: Added public field
android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE
/out/mydroid-ara/target/common/obj/PACKAGING/public_api.txt:116: error
5: Added public field
android.Manifest.permission.RECEIVE_EMERGENCY_BROADCAST
**************************** You have tried to change the API from what has been previously approved.
To make these errors go away, you have two choices: 1) You can add
"#hide" javadoc comments to the methods, etc. listed in the
errors above.
2) You can update current.txt by executing the following command:
make update-api
To submit the revised current.txt to the main Android repository,
you will need approval.
This occurred on both of my Ubuntu 15.04 boxes and was present when
when build AOSP android-5.0.2_r1 and android-5.1.0_r1.
For those of you who are unfamiliar with this portion of the Android
build, the Android framework exports all of the public portions of the
API and makes sure that the current build matches up with what's
located under frameworks/base/api/current.txt. It does this by
parsing frameworks/base/res/AndroidManifest.xml and any of the current
device's overlay .xml files and processes items marked with various
flags in the comments above them:#SystemApi, #hide, etc. This
parsing and processing portion of the checkapi stage is done by a
binary "aapt" (Android Asset Packagng Tool). It's source is located
under frameworks/base/tools/aapt.
I started by checking for upstream fixes to the platform/build or
platform/frameworks/base projects. After striking out, I began
debugging the android build via the use of: "make checkapi
showcommands" and then manually running the commands with "strace" to
see how each binary was involved and what output it generated.
After the first few hours of debugging, it became apparent that
out/target/common/obj/APPS/frameworks-res_intermediates/src/android/Manifest.java
file had comments which were being corrupted when aapt was generating
it. I was able to make some manual changes to the AndroidManifest.xml
file and get the build to pass (removing extra portions of the
comments).
Digging deeper via strace and then looking at various static link
sources, I found that during the AndroidManifest.xml comments
processing the #SystemApi token was being filtered out via a
String8.removeAll("#SystemApi") function call. Experimentally, I
removed this part of the processing. Lo and Behold! The build
worked. Taking a closer look at the removeAll function, I was able to
pin point a memcpy function as the part of the function which was
causing corruption.
I then researched memcpy a bit and noted that you are not supposed to
use memcpy on overlapping memory addresses, instead memmove was
preferred, because it makes a copy of the source prior to any changes
being made to the destination. After changing the use of memcpy to
memmove the build was fixed and all was well with the world!
As a good player in the open source world, I immediately thought I
should upstream this incredible feat of debugging to the master branch
of system/core. BUT, alas! The fix has been in the master branch
since November 11th 2014! And hasn't been brought into any of the
current development tags! grumble
https://android.googlesource.com/platform/system/core/+/dd060f01f68ee0e633e9cae24c4e565cda2032bd
I've since contacted the Google team about this change and let them
know of my experience in hopes that we may yet see this patch in
future release tags of Android.
Conclusion: apparently glibc is undergoeing some changes and some of
those have now filtered onto my Ubuntu boxes. Where previously the
memcpy usage was incorrect but still usable, it now causes the build
break I was seeing.
If you see this kind of error in your Android builds, and you're on a
newish version of Ubuntu or Debian distrobution, you may want to try
this simple patch and see if it helps.
Hash
Big up himself!
I do see the entries in my r8 code so you are probably safe running make update-api, and when that finishes then run your make command as normal.
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 try to make an android application in delphi but when i build the project i get this error:
[PAClient Error] Error: E0002 Missing profile name; use paclient -?
for Help
How can i fix this?
You may check your configuration as well in Delphi XE 8.1:
Build Configuration: RELEASE
Android: APPLICATION STORE
For instance DEBUG and APPLICATION STORE may result in a E00002 error.
For building Android applications in delphi, you do not use the PAServer nor PAClient, so there is no profile: these are only needed for iOS or OS X development.
To figure out what is calling PAClient and why the call fails, follow these steps:
Run Delphi while the free Process Monitor from SysInternals is active,
watch the Process Monitor log to see when the PAClient is executed, and what parameters there are.
Relate these parameters to the selected profile
Note that error E00002 means the PAClient has no profile name in the parameters.
Also check Project -> Deployment that all items are checked. That worked for me.
(I unchecked all items by mistake when adding some files for deployment manually)
Via FFernandes https://forums.embarcadero.com/thread.jspa?threadID=118789
whenever I add an Android project to a git repository using the eclipse plugin EGit I get this Error message
Failed to initialize Git team provider.
when visualising the error log I get this :
Failed to initialize Git team provider.
Problems encountered while moving resources.
Could not move '/SearchInContatsWithLoader'.
Could not move: D:\AndrComp\SearchInContatsWithLoader.
Problems encountered while deleting files.
Could not delete: D:\AndrComp\SearchInContatsWithLoader\libs\android-support-v4.jar.
Could not delete: D:\AndrComp\SearchInContatsWithLoader\libs.
Could not delete: D:\AndrComp\SearchInContatsWithLoader.
Check if you don't have a windows process blocking those file (keeping an handle on them), which would prevent another process (like EGit) to move them.
To solve the issue, try to close as many processes as you can (or, even better, reboot and launch just Eclipse), and try again your operation.
My issue is regarding PhoneGap and Android development using the Eclipse Applaud plugin. I downloaded and installed the Applaud plugin successfully. I can create a new project using the Applaud wizard (via the Eclipse toolbar icon), and the demo runs on the device fine. However, when I overwrite the existing html & js (only main.js, not phonegap.js) files, then build it to the device, the non device functionality works fine (button clicks/ui update/etc), but the PhoneGap commands such as (device.version/device.platform/etc) does not seem to work.
I have tried hooking this into the onDeviceReady event as well as making sure the .jar library is included, but I still have the same issue. So I guess my question is; when creating a PhoneGap solution using Applaud, does Eclipse need to compile and library, such as PhoneGap? and if so, how could someone go about doing such things?
Error Log:
01-24 14:59:44.567: W/KeyCharacterMap(5453): No keyboard for id 131074
01-24 14:59:44.567: W/KeyCharacterMap(5453): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
01-24 14:59:59.917: I/Web Console(5453): Failed to run constructor: TypeError: object is not a function at file:///android_asset/www/resources/js/phonegap-1.3.0.js:210
01-24 14:59:59.927: I/Web Console(5453): Failed to run constructor: TypeError: Cannot read property 'capture' of undefined at file:///android_asset/www/resources/js/phonegap-1.3.0.js:210
01-24 14:59:59.927: I/Database(5453): sqlite returned: error code = 14, msg = cannot open file at source line 25467
01-24 15:00:00.057: D/dalvikvm(5453): GC_CONCURRENT freed 1185K, 55% free 3188K/6983K, external 2630K/2814K, paused 2ms+3ms
So I'm back and have somehow fixed the issue I had (most likely by luck). When I started this project, I thought the best approach would be make this application as modular as possible; each functionality (web requests, file reading/writing, etc.) to be separated from one another. Thus I created lots of separate js files, each tagged with the appropriate name (network, device, language, etc.), and then included them in my index.html page which is then ran by phonegap.
In some of these files, I took the following approach:
var Device = {
// Returns the Device Name as a string.
Name: function() {
return window.device.name;
}
};
As a result, I could then access this functionality using the dot operator (which I prefer). However by doing so, resulted in many files relying one on another, making it difficult to track down my issue. After spending some time commenting and un-commenting functionality, It seems by using a combination of the above approach (dot operator) and my bad choice of naming conventions. The Device.Name() implementation above seemed to (not entirely certain on why/how) conflict with the PhoneGap libraries, consequently resulting in js errors on the device.
After changing the above name from "Device" to "Handset", my issue went away. A simple and maybe obvious solution to a painful afternoon.
I'll answer your question, but I don't think it is your problem:
Whether or not the AppLaud wizard just uses phonegap.jar or rebuilds its components depends upon how you use the project creation wizard.
If you use its "Built-in Phonegap" or point at a downloaded official release ("Enter path to installed PhoneGap"), it will just point at the phonegap.jar from that release. If you point at a directory with an unzipped github PhoneGap version, phonegap.jar will not be used and the PhoneGap Java sources will be built into your project. This makes for easy debugging of the PhoneGap implementation.
Regarding your problem, you likely have something wrong with your index.html file, like a misspelling of phonegap{...}.js. As ghostCoder says in the comments, you may need to share your code to get help on it.