Titanium JIRA Archive
Appcelerator Community (AC)

[AC-3534] Android 6 - Crash when app starts

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionNeeds more info
Resolution Date2016-05-03T19:12:30.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAlloy, Titanium SDK & CLI
Labelsandroid
ReporterAnna
AssigneeShak Hossain
Created2016-04-21T08:01:55.000+0000
Updated2016-05-03T19:12:30.000+0000

Description

My app works perfectly on Android under version 6, but on Android 6 this error appear when the app starts: It seems that si a problem in libraries or something like this. Device: Huawei P8
[ERROR] :  linker: readlink('/proc/self/fd/21') failed: Permission denied [fd=21]
[INFO] :   TiApplication: (main) [0,0] checkpoint, app created.
[INFO] :   TiApplication: (main) [116,116] Titanium 5.2.2 (2016/03/28 14:12 b685ddb)
[ERROR] :  linker: warning: unable to get realpath for the library "/system/lib/hw/gralloc.hi3635.so". Will use given name.
[ERROR] :  linker: readlink('/proc/self/fd/21') failed: Permission denied [fd=21]
[ERROR] :  linker: warning: unable to get realpath for the library "libion.so". Will use given name.
[ERROR] :  HAL: load: id=gralloc != hmi->id=gralloc
[INFO] :   DatabaseHelper: No value in database for platform key: 'unique_machine_id' returning supplied default ''
[INFO] :   DatabaseHelper: No value in database for platform key: 'hardware_machine_id' returning supplied default ''
[INFO] :   TiApplication: (main) [153,269] Titanium Javascript runtime: v8
[ERROR] :  linker: readlink('/proc/self/fd/26') failed: Permission denied [fd=26]
[ERROR] :  linker: warning: unable to get realpath for the library "/data/app/es.epi.emporda-1/lib/arm/libstlport_shared.so". Will use given name.
[ERROR] :  linker: readlink('/proc/self/fd/26') failed: Permission denied [fd=26]
[ERROR] :  linker: warning: unable to get realpath for the library "/data/app/es.epi.emporda-1/lib/arm/libkroll-v8.so". Will use given name.
[INFO] :   HwCust: Constructor found for class android.app.HwCustHwWallpaperManagerImpl
[INFO] :   TiRootActivity: (main) [0,0] checkpoint, on root activity create, savedInstanceState: null
[WARN] :   V8Object: (KrollRuntimeThread) [64,64] Runtime disposed, cannot set property 'userAgent'
[WARN] :   TiTempFileHelper: (main) [17,81] The external temp directory doesn't exist, skipping cleanup
[ERROR] :  linker: readlink('/proc/self/fd/26') failed: Permission denied [fd=26]
[ERROR] :  linker: warning: unable to get realpath for the library "/data/app/es.epi.emporda-1/lib/arm/libanalytics.google.so". Will use given name.
[ERROR] :  linker: readlink('/proc/self/fd/26') failed: Permission denied [fd=26]
[ERROR] :  linker: warning: unable to get realpath for the library "/data/app/es.epi.emporda-1/lib/arm/libti.map.so". Will use given name.
[ERROR] :  linker: readlink('/proc/self/fd/26') failed: Permission denied [fd=26]
[ERROR] :  linker: warning: unable to get realpath for the library "/data/app/es.epi.emporda-1/lib/arm/libes.epi.comscore.so". Will use given name.
[ERROR] :  linker: readlink('/proc/self/fd/26') failed: Permission denied [fd=26]
[ERROR] :  linker: warning: unable to get realpath for the library "/data/app/es.epi.emporda-1/lib/arm/libcom.rkam.swiperefreshlayout.so". Will use given name.
[ERROR] :  linker: readlink('/proc/self/fd/26') failed: Permission denied [fd=26]
[ERROR] :  linker: warning: unable to get realpath for the library "/data/app/es.epi.emporda-1/lib/arm/libfacebook.so". Will use given name.
[ERROR] :  TiApplication: (KrollRuntimeThread) [48,129] Sending event: exception on thread: KrollRuntimeThread msg:java.lang.UnsatisfiedLinkError: dlopen failed: /data/app/es.epi.emporda-1/lib/arm/libfacebook.so: has text relocations; Titanium 5.2.2,2016/03/28 14:12,b685ddb
[ERROR] :  TiApplication: java.lang.UnsatisfiedLinkError: dlopen failed: /data/app/es.epi.emporda-1/lib/arm/libfacebook.so: has text relocations
[ERROR] :  TiApplication: 	at java.lang.Runtime.loadLibrary(Runtime.java:384)
[ERROR] :  TiApplication: 	at java.lang.System.loadLibrary(System.java:1086)
[ERROR] :  TiApplication: 	at org.appcelerator.kroll.runtime.v8.V8Runtime.loadExternalModules(V8Runtime.java:132)
[ERROR] :  TiApplication: 	at org.appcelerator.kroll.runtime.v8.V8Runtime.initRuntime(V8Runtime.java:99)
[ERROR] :  TiApplication: 	at org.appcelerator.kroll.KrollRuntime.doInit(KrollRuntime.java:205)
[ERROR] :  TiApplication: 	at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:114)

Comments

  1. Nazmus Salahin 2016-04-21

    Hello, It's the runtime permission issue of Android 6. Beginning in Android 6.0 (API level 23), users grant permissions to apps while the app is running, not when they install the app. So if you need any permission that is grouped in "Dangerous Permission" you will need to ask that permission first and get granted. Most common permissions are "Camera" and "External Storage", "Location" etc. Please figure out what permission do you need in your project and ask that permission first before launching tasks. Here is an example of how camera permission is asked in appelerator.
       if (Ti.Media.hasCameraPermissions()) {
       	return alert('You already have permission.');
       } else {
       
       	Ti.Media.requestCameraPermissions(function(e) {
       		if (e.success) {
       			alert('You were granted permission.');
       		} else {
       			alert('ou were denied permission for now, forever or the dialog did not show at all because it was denied forever before.');
       		}
       	});
       }
       
    Thanks
  2. Anna 2016-04-21

    This cause that the app can't open??? This libs too?? libstlport_shared.so., libkroll-v8.so, libcom.rkam.swiperefreshlayout.so
  3. Stephen Feather 2016-04-21

    In android 5, text relocations caused a warning. In android 6, text relocations cause a halt. It appears as though the version of the facebook module you are using was compiled with an older version of the NDK. The module and its child libraries would need to be rebuilt with an updated NDK to remove the text relocations.
  4. Anna 2016-04-21

    Ok, thank you. I'm trying to solve it.
  5. Anna 2016-04-26

    I'm using this function to solve the problem but the error still being the same:
       exports.checkPermissions = function(){
       	
       	var permissionsToRequest = [];
       	 
       	// check WRITE_EXTERNAL_STORAGE permission
       	var storagePermission = "android.permission.WRITE_EXTERNAL_STORAGE";
       	var hasStoragePermission = Ti.Android.hasPermission(storagePermission);
       	  
       	if(!hasStoragePermission){
       		permissionsToRequest.push(storagePermission);
       	}
       	  
       	// check ACCESS_COARSE_LOCATION permission
       	var locationPermission = "android.permission.ACCESS_COARSE_LOCATION";
       	var hasLocationPermission = Ti.Android.hasPermission(locationPermission);
       	  
       	if(!hasLocationPermission){
       		permissionsToRequest.push(locationPermission);
       	}
       	
       	// check ACCESS_FINE_LOCATION permission
       	var location2Permission = "android.permission.ACCESS_FINE_LOCATION";
       	var hasLocation2Permission = Ti.Android.hasPermission(location2Permission);
       	  
       	if(!hasLocation2Permission){
       		permissionsToRequest.push(location2Permission);
       	}
       	  
       	// request permission
       	Ti.Android.requestPermissions(permissionsToRequest, function(e) {
       		if (e.success) {
       			Ti.API.info("SUCCESS");
       			callback();
       		} else {
       			Ti.API.info("ERROR: " + e.error);
       		}
       	});	
       };
       
  6. Anna 2016-04-26

    The new error is:
       [ERROR] :  TiExceptionHandler: (main) [1,655] - Message: Uncaught TypeError: Object #<Android> has no method 'hasPermission'
       
  7. Nazmus Salahin 2016-04-27

    Hello [~amurcia], Your are not requesting permission in right way. You can use ti.permission module for run-time permission. [Module Link](http://gitt.io/component/ti.permissions) Thanks
  8. Anna 2016-04-27

    This appear in the readme of this module: OTE (Implementation hints) After merging of PR #7778 the Appcelerator guys unfortunately decided to strip down the functionality of the implementation. So there is no way to support this module with the current API anymore :-( Sorry for that! The official API is now part of Ti.Android and can be used as follows:
         // check permission
       
         var storagePermission = "android.permission.READ_EXTERNAL_STORAGE";
         var hasStoragePermission = Ti.Android.hasPermission(storagePermission);
       
       
         // request permission
       
         Ti.Android.requestPermissions(permissionsToRequest, function(e) {
             if (e.success) {
                 Ti.API.info("SUCCESS");
             } else {
                 Ti.API.info("ERROR: " + e.error);
             }
         });
       
  9. Nazmus Salahin 2016-04-27

    Hello [~amurcia], Ti.Android API can be used as mentioned with SDK 5.4.0 (Which is still in beta) or later. For earlier version you can used this module and the given example is like this.
       var tipermissions = require('ti.permissions');  // will return same instance as other require calls
       
       //Add behavior for UI
       label.addEventListener('click', function(e) {
       	  hasPerm = tipermissions.hasPermission("android.permission.CAMERA");
             Ti.API.log("error","Critical Permission " + hasPerm);
       
             tipermissions.requestPermission("android.permission.CAMERA",123,function(e) {
                        Ti.API.log("error","In callback " + e.success + " " + e.code + " " + e.requestCode);
                     });
       
       	});
       

JSON Source