[AC-5864] Android App Not working properly on New versions of Android
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Resolved |
Resolution | Not Our Bug |
Resolution Date | 2018-09-05T18:21:54.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | n/a |
Reporter | Pankti Pancholi |
Assignee | Shak Hossain |
Created | 2018-08-27T14:47:05.000+0000 |
Updated | 2018-09-06T00:31:20.000+0000 |
Description
My app was not working properly on Android new versions so I have updated new titanium SDK 7.3.0 GA to make it work but it is still not working.
- Data from external APIs are not loading on app.
- I have added new API in my android sdk for new versions such as API 28, set targeted minimum and maximum sdk versions according to it in tiapp.xml
- On emulator I am getting [ERROR] Application Installer abnormal process termination. Process exit value was 1
I am not able to run the app
Hello, we need your setup confiration details. Share with the "appc ti setup check" log. We also need a sample reproducible test code/app for us to verify the issue. Thanks.
──────────────────┤ Check Environment ├─────────────────── Node.js ✓ node installed (v8.9.1) ✓ npm installed (v5.10.0) Titanium CLI ★ cli new version v5.2.0 available (currently v5.1.1) Titanium CLI Dependencies ✓ acs up-to-date (v2.0.10) ✓ alloy up-to-date (v1.12.0) ✓ appc-cli-titanium up-to-date (v4.4.17) ✓ appc-inquirer up-to-date (v0.1.10) ✓ appc-logger up-to-date (v1.1.27) ✓ appc-platform-sdk up-to-date (v3.0.2) ✓ appcd up-to-date (v1.1.3) ✓ arrow up-to-date (v3.0.0) ✓ async up-to-date (v1.5.2) ✓ chalk up-to-date (v1.1.3) ✓ char-spinner up-to-date (v1.0.1) ✓ columnify up-to-date (v1.5.4) ✓ commander up-to-date (v2.9.0) ✓ debug up-to-date (v2.6.9) ✓ ejs up-to-date (v2.6.1) ✓ fields up-to-date (v0.1.24) ✓ fs-extra up-to-date (v0.26.7) ✓ inquirer up-to-date (v0.11.4) ✓ ip up-to-date (v1.1.5) ✓ jwt-simple up-to-date (v0.3.1) ✓ lodash up-to-date (v3.10.1) ✓ mkdirp up-to-date (v0.5.1) ✓ node-appc up-to-date (v0.2.48) ✓ node-forge up-to-date (v0.6.49) ✓ node-ios-device up-to-date (v1.6.2) ✓ npm-conf up-to-date (v1.1.3) ✓ pac-proxy-agent up-to-date (v2.0.2) ✓ plural up-to-date (v0.2.1) ✓ progress up-to-date (v1.1.8) ✓ recursive-readdir up-to-date (v2.2.2) ✓ request up-to-date (v2.87.0) ✓ retire up-to-date (v1.6.2) ✓ semver up-to-date (v5.5.0) ✓ tar up-to-date (v4.0.2) ✓ tiapp.xml up-to-date (v0.2.2) ✓ titanium up-to-date (v5.1.1) ✓ version-bump-prompt up-to-date (v3.1.2) ✓ which up-to-date (v1.3.1) ✓ wrench up-to-date (v1.5.9) Titanium SDK ✓ latest sdk installed (v7.3.0.GA) ✓ selected sdk up-to-date (v7.3.0.GA) Mac OS X Environment ✓ CLI Tools installed iOS Environment ✓ Xcode installed (9.4.1) ✓ iOS SDK installed (11.4) ✓ WWDR cert installed ✓ developer cert installed (1 found) ✓ distribution cert installed (1 found) ✓ dev provisioning installed (22 found) ✓ dist provisioning installed (17 found) Android Environment ✓ sdk installed (/Users/ppancholi/Library/Android/sdk) ✓ tools installed (v26.1.1) ! platform tools untested version 28.0.0; may or may not work ! build tools untested version 28.0.0; may or may not work ✓ adb installed /Users/ppancholi/Library/Android/sdk/platform-tools/adb ✕ android "android" executable not found; please reinstall Android SDK ✓ emulator installed /Users/ppancholi/Library/Android/sdk/emulator/emulator ✓ mksdcard installed /Users/ppancholi/Library/Android/sdk/tools/mksdcard ✓ zipalign installed /Users/ppancholi/Library/Android/sdk/build-tools/28.0.0/zipalign ✓ aapt installed /Users/ppancholi/Library/Android/sdk/build-tools/28.0.0/aapt ✓ aidl installed /Users/ppancholi/Library/Android/sdk/build-tools/28.0.0/aidl ✓ targets installed (8 found) ✓ avds installed (3 found) ✓ ndk installed (17.1.4828580) ✓ ndk-build installed (/Users/ppancholi/Library/Android/sdk/ndk-bundle/ndk-build) Java Development Kit ✓ jdk installed (v1.8.0) ✓ java installed /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/java ✓ javac installed /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/javac ✓ keytool installed /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/keytool ✓ jarsigner installed /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/jarsigner Intel® Hardware Accelerated Execution Manager (HAXM) ✓ compatible ! installed not found; install HAXM to use Android x86 emulator Network ✓ online - no proxy server configured ✕ http://preview.appcelerator.com (HTTP status: 502) is unreachable ✕ https://preview.appcelerator.com (HTTP status: 502) is unreachable ✓ Java-based connection test Directory Permissions ✓ home directory ✓ titanium config directory ✓ titanium sdk install directory ✓ temp directory ──────────────────────┤ Main Menu ├─────────────────────── 1) quick Quick Setup 2) check Check Environment 3) user User Information 4) app New App Defaults 5) network Network Settings 6) cli Titanium CLI Settings 7) sdk Titanium SDK Settings 8) ios iOS Settings 9) android Android Settings 10) exit Exit Where do you want to go?
How can I generate sample reproducible test code/app?
Do not target API Level 28 (aka: Android 9, aka: Android P). Doing so will introduce breaking changes that Titanium has not addressed yet. https://developer.android.com/about/versions/pie/android-9.0-changes-all Titanium currently targets up to API Level 27. This is what we recommend. And apps targets API Level 27 will be ran in backward compatibility mode on Android P without any of the breaking changes. This is what you need. [https://docs.appcelerator.com/platform/latest/#!/guide/Titanium_Compatibility_Matrix](https://docs.appcelerator.com/platform/latest/#!/guide/Titanium_Compatibility_Matrix-section-src-29004837_safe-id-VGl0YW5pdW1Db21wYXRpYmlsaXR5TWF0cml4LUFuZHJvaWRTREsvVGFyZ2V0QW5kcm9pZHBsYXRmb3Jt) We plan on targeting Android P in Titanium 7.5.0.
This is happening even if I target Lower API such as API 27 or 26,
You're targeting API Level 23, not 27. And you should get rid of the max setting. So, change it to the below...
And are you sure you want to set the min API Level to 23? Doing so will prevent your app from being downloaded onto Android 5.x and older OS versions. If you still can't install your APK, then you're running into a different problem. Try installing your APK to the device manually via Google's "adb" tool at the command line to see what error message appears. You can find this tool under the
./AndroidSdk/tools
directory. The command line is...I am not able to run it even in Emulator as well, Not only device.. Everywhere I am getting [ERROR] Application Installer abnormal process termination. Process exit value was 1 Not sure why but I am pretty sure that I have started getting this error after I have updated to titanium SDK 7.3.0 GA
Thanks for your help, I figured out where the issue was. I have one more question, Is there any syntax deprecation or anything happening with new API, and Titanium 7.3.0 GA as I am getting all different run time errors because of syntax changes in my APP. Uncaught type error and ao on, also my data from API are not displaying in new devices with new version such as s8, s9 with os 8.0.0 , It is coming good on iOS so there is no issue from API side.
If you're upgrading between Titanium 7.0.0 to 7.3.0, then you should be fine. Can you give us a log of the errors please?
no, I am upgrading from the 7.2.0 to 7.3.0, Basically, I have to upgrade 7.2.0 for iOS 11.4.0 and I was doing it for the first time so I have updated it for both platform. before two months and after with this new version on Android it is not working... My app is working fine with old android devices with new os i.e: Samsung s7 with Android 8.0.0 will work fine but with Samsung s8, s9 and os 8.0.0 will not work. [INFO] : AssistStructure: Flattened final assist data: 8816 bytes, containing 1 windows, 32 views [INFO] : APSAnalyticsRunnable: Analytics Started [INFO] : APSAnalyticsRunnable: Stopping Analytics [ERROR] : TiExceptionHandler: (main) [178568,245110] /alloy/controllers/profileRegister.js:406 [ERROR] : TiExceptionHandler: var errorKey = Object.keys(response.status); [ERROR] : TiExceptionHandler: ^ [ERROR] : TiExceptionHandler: TypeError: Cannot convert undefined or null to object [ERROR] : TiExceptionHandler: at Function.keys (
It looks like inside the "onerror" callback of your "Ti.Network.HTTPClient" instance of the "profileRegister" controller you tried to pass null/undefined where an object was expected. Does that sound familiar?
It does sound familiar and I figured out that yesterday but my question to you is any changes happen on new version of titanium 7.3.0.GA for Ti.Network.HTTPClient because it is working perfectly for older API but not new phone such as not in 26, 27 even though it was working fine before on 26 as well. Is there any thing new with this network module now?
There are TIMOB-26010 and TIMOB-20367 which have both been fixed in 7.3.0.
Ok, Thanks for your help, let me dig into it
I have checked all possible options, everything is working fine, I am getting exact proper value in console but while doing xhr.send , I feel it is changing value, Any one having same issue with xhr.send only in new Android device with new android os and with titanium 7.3.0
Can you give us any more details? Or a reproducible case? Because we're not seeing any HTTPClient issues on our end.
I did not push any update to playstore, but after new android updates few people could not connect, I have checked about titanium 7.3.0 for new android update and did those update in my code, People are not able to connect to app or none of the data form API displaying ---- Code: ----- function connectAccount(evt){ validator.run([ { id: 'connect_email', value: $.connect_email.value, display: 'Email', rules: 'required|valid_email' } ], function(errors){ //Errors in the form if(errors.length > 0) { for (var i = 0; i < errors.length; i++) { Ti.API.debug(errors[i].message); } alert(errors[0].message); } else { var xhr = Titanium.Network.createHTTPClient(); xhr.onload = function(e) { $.form_holder.remove($.connect_form); $.form_holder.remove($.register_form); var activateView = Alloy.createController('activateForm', {parent: $.win_register_form, mainWindow: $.args.parentWindow, setMainPanel: $.args.setMainPanel}); $.form_holder.add(activateView.getView()); Alloy.Globals.gaTracker.addEvent({ category:"fashionicity-account", action:"connection-code-requested", label:"", value: 1 }); activateView.focusField(); }; xhr.onerror = function(e){ Alloy.Globals.gaTracker.addException({ description:"error connecting account", fatal:false }); var response = JSON.parse(e.source.responseText); var errorKey = Object.keys(response.status); alert(errorKey + ': ' + response.status[errorKey][0]); }; xhr.open('POST', Alloy.Globals.baseUrl + 'app/request_connection_code/'); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.setRequestHeader("Authorization", "Bearer " + Alloy.Globals.bearer); xhr.send({email: $.connect_email.value}); } }); } ---- Please check below details for my environment ---- Chris-13-MacBook-Pro:~ ppancholi$ appc info Appcelerator Command-Line Interface, version 7.0.5 Copyright (c) 2014-2018, Appcelerator, Inc. All Rights Reserved. Operating System Name = Mac OS X Version = 10.13.5 Architecture = 64bit # CPUs = 4 Memory = 8.0GB Node.js Node.js Version = 8.9.1 npm Version = 5.10.0 Appcelerator CLI Installer = 4.2.13 Core Package = 7.0.5 Titanium CLI CLI Version = 5.1.1 node-appc Version = 0.2.44 Titanium SDKs 7.3.0.GA Version = 7.3.0 Install Location = /Users/ppancholi/Library/Application Support/Titanium/mobilesdk/osx/7.3.0.GA Platforms = iphone, android git Hash = 35af917 git Timestamp = 8/16/2018 23:01 node-appc Version = 0.2.45 7.2.0.GA Version = 7.2.0 Install Location = /Users/ppancholi/Library/Application Support/Titanium/mobilesdk/osx/7.2.0.GA Platforms = iphone, android git Hash = ecae6740fe git Timestamp = 6/7/2018 12:25 node-appc Version = 0.2.45 7.1.0.GA Version = 7.1.0 Install Location = /Users/ppancholi/Library/Application Support/Titanium/mobilesdk/osx/7.1.0.GA Platforms = iphone, android git Hash = df92fbf git Timestamp = 3/14/2018 20:46 node-appc Version = 0.2.43 7.0.2.GA Version = 7.0.2 Install Location = /Users/ppancholi/Library/Application Support/Titanium/mobilesdk/osx/7.0.2.GA Platforms = iphone, android git Hash = 5ef0c56 git Timestamp = 2/9/2018 19:05 node-appc Version = 0.2.43 Mac OS X Command Line Tools = installed Intel® Hardware Accelerated Execution Manager (HAXM) Not installed Java Development Kit Version = 1.8.0_131 Java Home = /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
It is still working fine with some Android Device and not for other
So, I think the issue is coming from the following part of your
onerror
code...The problem with the above is that you're assuming that you've received a response in the
onerror
callback. If your app fails to connect to the server (ie: a timeout), then there is no response. The "responseText" property will be set to an empty string. And the issue with that of course if that yourJSON.parse(responseText)
function call will return an empty dictionary... which means the "status" field will be undefined. You can reproduce this issue by disabling wifi on your device. Theonerror
event argument's "code" property will provide the HTTP status code that you're looking for. It will also be set to -1 if a timeout occurred.This issue I have already fixed, Now, Main issue is all *{color:red}server calls{color}* for android that too for few devices are getting response 401 instead 200, it should get 200 Code to check response code which I have for null response handling, if (response.status !== undefined ) { var errorKey = Object.keys(response.status); alert(errorKey + ': ' + response.status[errorKey][0]); } else{ alert('Error status' + ': ' + e.error); }
If you're getting a 401 response, then perhaps the authorization request header is not being set to what you think it is? Try logging it before setting the header as shown below.
Also, you can run into an https error if the device's system clock is not set to current time. So, make sure that the device's system clock is correct for your region.
Thanks for your help it is sending Authorization: Bearer null for few devices. - I am not sure why it is not taking Bearer code from few devices but it is working for other devices, When I see my logs in backend I can see for android app logs that there are different titanium versions are coming for different users.. titanium SDK 7.1.0 it is giving 200 coed when they try to connect but for titanium 7.2.0 and 7.3.0 it is giving 401 error, Also, after titanium and android update I am getting following error [ERROR] : E/ti.goosh.RegistrationIntentService: Failed to get GCM Registration Token:INVALID_SENDER [ERROR] : Notifications: Retrieve device token failed [object Object]
I guess my live app's version running two titanium sdk at the same time, is it possible? As I am new to this app and previous developer doesn't have any documentation on it and I am kind of new to appcelerator and titanium as well started using it 2 months back only. So, not sure about it.
Hello, The Titanium SDK you select on the tiapp.xml file, The project should run on that SDK. Can you explain what you mean? possible with a log? Thanks.
I got the idea about titanium SDK, Can you please explain me how can I revert back to all old version of titanium sudo npm install -g appcelerator appc use latest appc setup -l trace sudo npm install -g alloy I am using this command and instead of latest I am using version number but it is not working for me
If you don't have the previous CLI installed on your system then you cant revert back to it. Please share the log of your command above. Thanks.
I'm not convinced that this is a bug in Titanium 7.3.0 yet. Especially since we've proved that the Authorization HTTP header is being set to
null
in your code. The issue is that yourAlloy.Globals.bearer
global has not been assigned yet by your app by the time it wants to use it. Also note that Titanium 7.3.0 has supports Android 8, which Google Play requires apps to target. The deadline for existing apps on Google Play to target Android 8 is this coming November. https://android-developers.googleblog.com/2017/12/improving-app-security-and-performance.htmlHi Joshua, Thanks for all your help, I have resolve the issue with my app. It was weird that Sender_ID on my app which I was using till now is changed in https://console.cloud.google.com/ and I have to use new one and it solved all my errors. I have a question on that does google changes it often with updates? curious to know as I am being new with App development, I was doing simple javascript web development only before.
Glad you go it working! Regarding breaking-changes, Google tends to make them more often than Apple unfortunately. For example, Google's push notification system has changed twice. They were originally using C2DM, then changed it to GCM, and then changed it to use Firebase. And Google tends to make breaking changes in every major Android OS version, which they document here... https://developer.android.com/about/versions/pie/android-9.0-changes-all You may want to keep an eye on Google's Android developer blog for announcements. They usually document most of their breaking-changes, but unfortunately they don't always document/announce them all. https://android-developers.googleblog.com With the Titanium SDK, we'll try to shield app developer from some of the breaking changes. Many of them we can handle on our end so that you don't have to worry about it. But some breaking-changes we can't handle automatically and have to provide a feature for app developers to use handle it. Case-in-point, if you want acquire GPS data while your app is in the background, you have to use a "foreground-service" as of Android 8, which is a feature we provide as of Titanium 7.3.0. Anyways, I hope this helps! :)