Unity CommandInvokationFailure: Unable to install APK to device. Permission denied - android

I try to build Unity app to Android and receive next error:
CommandInvokationFailure: Unable to install APK to device.
Please make sure the Android SDK is installed and is properly configured in the Editor.
See the Console for more details.
/Users/tedromanus/Library/Android/sdk/platform-tools/adb -s "0123456789ABCDEF" install -r "/Users/tedromanus/Workspace/SoftServe/GPSTest/Builds/GPSTest.apk"
stderr[
]
stdout[
[ 0%] /data/local/tmp/GPSTest.apk
[ 0%] /data/local/tmp/GPSTest.apk
[ 0%] /data/local/tmp/GPSTest.apk
[ 1%] /data/local/tmp/GPSTest.apk
[ 1%] /data/local/tmp/GPSTest.apk
[ 1%] /data/local/tmp/GPSTest.apk
[ 1%] /data/local/tmp/GPSTest.apk
[ 2%] /data/local/tmp/GPSTest.apk
[ 2%] /data/local/tmp/GPSTest.apk
[ 2%] /data/local/tmp/GPSTest.apk
adb: error: failed to copy '/Users/tedromanus/Workspace/SoftServe/GPSTest/Builds/GPSTest.apk' to '/data/local/tmp/GPSTest.apk':
Permission denied
]
exit code: 255
How can I fix it?
Thanks for response.

do you own the tedromanus user folder? if not, make sure you have admin permission to access that folder.
if you have multiple user accounts on the device, you might make sure that you are on the admin account and if that still doesn't work, deleting any trace of the app off of other user accounts and retrying,
otherwise, I've seen elsewhere that a rooted android device might have this problem.

Related

Cannot run avd with custom kernel

I want to run a custom kernel build from ci.android.com on an avd. I downloaded the kernel files from here. I start the avd like so - ~/Library/Android/sdk/emulator/emulator -avd Pixel_6_Pro_API_32 -show-kernel -netspeed full -debug init -verbose -writable-system -kernel Image. However the boot fails with the following logs
[ 0.511774][ T1] input: gpio-keys as /devices/platform/gpio-keys/input/input0
[ 0.512810][ T1] ALSA device list:
[ 0.513168][ T1] No soundcards found.
[ 0.513800][ T1] uart-pl011 9000000.pl011: no DMA platform data
[ 0.517151][ T1] Freeing unused kernel memory: 1536K
[ 0.542181][ T1] Run /init as init process
[ 0.551684][ T1] init: init first stage started!
[ 0.552764][ T1] init: Loading module /lib/modules/ac97_bus.ko with args ''
[ 0.553928][ T1] ac97_bus: disagrees about version of symbol module_layout
[ 0.555305][ T1] init: Failed to insmod '/lib/modules/ac97_bus.ko' with args '': Exec format error
[ 0.556731][ T1] init: LoadWithAliases was unable to load ac97_bus
[ 0.557747][ T1] init: Copied ramdisk prop to /second_stage_resources/system/etc/ramdisk/build.prop
[ 0.558989][ T1] init: [libfs_mgr]ReadFstabFromDt(): failed to read fstab from dt
[ 0.560418][ T1] init: Using Android DT directory /proc/device-tree/firmware/android/
[ 0.569781][ T1] init: bool android::init::BlockDevInitializer::InitDevices(std::set<std::string>): partition(s) not found in /sys, waiting for their uevent(s): metadata, super
VER
I know this is because of the loaded kernel modules. I have the kernel modules as well. But I have no idea how to replace them. I pushed them to /vendor/lib/modules. That didn't help. Any ideas? Thanks!

How to build a specific Android cli executable (service.cpp)

In android, when you open a terminal emulator or connect an adb shell, there is a command service that you can execute which allows you to interact with system services to some degree. For my purposes the functionality is too limited though and I would like to expand it a little.
Unfortunately this executable is not documented.
I have located the source code here: service.cpp
There is also a file called Android.bp in the same directory with the following content:
cc_binary {
name: "service",
srcs: ["service.cpp"],
shared_libs: [
"libcutils",
"libutils",
"libbinder",
],
cflags: [
"-DXP_UNIX",
"-Wall",
"-Werror",
],
}
cc_binary {
name: "vndservice",
proprietary: true,
srcs: ["service.cpp"],
shared_libs: [
"libcutils",
"libutils",
"libbinder",
],
cflags: [
"-DXP_UNIX",
"-DVENDORSERVICES",
"-Wall",
"-Werror",
],
}
Those cflags look like g++ flags to me. I don't really know g++, but after a lot of trial and error I ended up with this:
# Download required source code
git clone https://android.googlesource.com/platform/superproject
cd superproject
git submodule init
git submodule update frameworks/native
git submodule update system/libbase
git submodule update system/core
git submodule update system/logging
# Set required include directories in CPATH
export CPATH="./frameworks/native/include:./system/libbase/include:./system/core/libcutils/include:./system/core/libutils/include:./system/logging/liblog/include:./system/core/libsystem/include:./frameworks/native/libs/binder/include"
# Build
g++ -DXP_UNIX -Wall -Werror -o service ./frameworks/native/cmds/service/service.cpp
Unfortunately I get a massive amount of errors:
https://pastebin.com/fnu7LJLU
My G++ version is:
g++ (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2)
Any ideas why this is failing?

How to fix sepolicy error in android emulator (goldfish kernel + android-9) boot loop

I want to run custom kernel ( goldfish ) on android-9 (API 28) avd.
So I just downloaded goldfish kernel:
git clone https://android.googlesource.com/kernel/goldfish/ -b android-4.4
make x86_64_ranchu_defconfig
make -j4
then I run emulator :
emulator -avd test -kernel goldfish/arch/x86/boot/bzImage -show-kernel
But there is some error between my kernel and SELinux policy of vendor.
Here the logs:
[ 1.170669] init: init first stage started!
[ 1.172289] init: Using Android DT directory /sys/bus/platform/devices/ANDR0001:00/properties/android/
[ 1.174652] init: First stage mount skipped (missing/incompatible fstab in device tree)
[ 1.176724] init: Skipped setting INIT_AVB_VERSION (not in recovery mode)
[ 1.178464] init: Loading SELinux policy
[ 1.182955] init: No precompiled sepolicy: No such file or directory
[ 1.184557] init: Compiling SELinux policy
[ 1.185672] init: Failed to read /vendor/etc/selinux/plat_sepolicy_vers.txt: No such file or directory
[ 1.188030] init: Unable to load SELinux policy
[ 1.189192] init: Reboot start, reason: reboot, rebootTarget: bootloader
Obviously the system go in boot loop.
How can I fix this?

make_ext4fs corrupts system.img on Android 6.0.1

I am using since Android 4.4 the tool make_ext4fs to repack Samsung system images.
make_ext4fs -s -l [size] -a [mount-point] -S [file_contexts] [out_file] [src_folder]
This works fine for sparsed file systems up to Android 5.1.1. I need to repack an Android 6.0.1 system.img of a Samsung device. There aren't any errors, flashing works too but the Wifi device is broken.
This is the logcat output
...
08-30 13:38:35.489 I/WifiHW ( 2149): wifi_change_fw_path(): fwpath = /system/etc/wifi/bcmdhd_sta.bin
08-30 13:38:35.489 E/WifiHW ( 2149): Cannot open "/data/.cid.info": No such file or directory
...
08-30 13:38:35.809 I/wpa_supplicant( 3181): nl80211: deinit ifname=wlan0 disabled_11b_rates=0
08-30 13:38:35.809 E/wpa_supplicant( 3181): Could not read interface wlan0 flags: No such device
08-30 13:38:35.809 E/wpa_supplicant( 3181): wlan0: Failed to initialize driver interface
...
This the kmsg output
[5.560176] [2: sh: 2269] macloader: Not yet wlan interface loaded
I tried to compare the stock and the repacked images, but they are compressed and not comparable.
Has anything changed with the img format from Android 5.1.1 to Android 6.0.1 or is this a Samsung specific problem? The file_contexts is exracted from the stock boot.img. I think the selinux permissions are fine but I am not sure if the regular permissions are set correrctly. Is there a way to get sure the mac permissions will be preserved?
Update
I've rebuilt make_ext4fs with branch android-6.0.1 according to this link (https://gist.github.com/monyxie/3128671a1f9508b7b9cdcf803e55af1e) which has new options added.
[ -l <len> ] [ -j <journal size> ] [ -b <block_size> ]
[ -g <blocks per group> ] [ -i <inodes> ] [ -I <inode size> ]
[ -L <label> ] [ -f ] [ -a <android mountpoint> ] [ -u ]
[ -S file_contexts ] [ -C fs_config ] [ -T timestamp ]
[ -z | -s ] [ -w ] [ -c ] [ -J ] [ -v ] [ -B <block_list_file> ]
<filename> [[<directory>] <target_out_directory>]
The added option [-C fs_config] let you set the permission of every single file and expects a list of files with its uid / gid / mac-permissions / (optional SELinux context). make_ext4fs throws an error if theres is any file without a config defined.
...
system/bin 0 0 755 u:object_r:system_file:s0
system/bin/iptables 0 0 750 u:object_r:system_file:s0
system/bin/ip6tables 0 0 750 u:object_r:system_file:s0
...

Appcelerator CLI throwing exception when build

I'd been using appcelerator CLI for a while and everything is working, until today.
Suddenly when i try to run the following command, an error occur:
appc ti build --platform android -T device
C:\Users\User\.appcelerator\install\5.0.2\package\node_modules\appc-cli-titanium\node_modules\titanium\node_modules\longjohn\dist\longjohn.js:185
throw e;
^
TypeError: Invalid Version: build.0.0
I tried to search and found that there are a lot of post regarding the longjohn.js throwing e as error, but none of them is having the error message Invalid Version: build.0.0
I'm running this from Windows 7, using appcelerator 5.0.2. Targetted android platform
Anyone encountered this issue before? Any suggestion or steps to fix this?
Thank you
UPDATE
Tried to run appc info and got the following error:
Appcelerator Command-Line Interface, version 5.0.2
Copyright (c) 2014-2015, Appcelerator, Inc. All Rights Reserved.
[PLUGIN-LOAD] 0ms C:\Users\User\.appcelerator\install\5.0.2\package\appc.js
[PLUGIN-LOAD] 776ms C:\Users\User\.appcelerator\install\5.0.2\package\node_modules\appc-cli-titanium\appc.js
[PLUGIN-LOAD] 0ms C:\Users\User\.appcelerator\install\5.0.2\package\node_modules\arrow\appc.js
ERROR | titanium exited with exit code 8. re-run with -l trace to get detailed output
I tried appc ti clean but it doesn't help as well.
UPDATE with -l trace
Below is the result i got running appc info -l trace:
Appcelerator Command-Line Interface, version 5.0.2 Copyright (c) 2014-2015, Appcelerator, Inc. All Rights Reserved.
__command__ search paths: [ "C:\\Users\\User\\.appcelerator\\install\\5.0.2\\package", "C:\\Users\\User\\.appcelerator\\install\\5.0.2\\package\\node_modules", "D:\\appcelerator_workspace\\BlackButton\\modules", "D:\\appcelerator_workspace\\BlackButton\\plugins", "D:\\appcelerator_workspace\\BlackButton\\node_modules", "D:\\appcelerator_workspace\\node_modules", "D:\\node_modules", "C:\\Users\\User\\.appcelerator\\.npm\\lib\\node_modules" ] [PLUGIN-LOAD] 0ms C:\Users\User\.appcelerator\install\5.0.2\package\appc.js [PLUGIN-LOAD] 718ms C:\Users\User\.appcelerator\install\5.0.2\package\node_modules\appc-cli-titanium\appc.js [PLUGIN-LOAD] 1ms C:\Users\User\.appcelerator\install\5.0.2\package\node_modules\arrow\appc.js log level set to "trace" executing command "info" set environment to {"registry":"https://software.appcelerator.com","security":"https://security.appcelerator.com","baseurl":"https://platform.appcelerator.com"}
checking credentials for existing session Attempting to load session info from config file check if session is invalidated session expiry 1449554288096 false Arrow Cloud config file: C:\Users\User\.acs found Arrow Cloud login { mid: 'ce9aca6f8de18937ab3063f00c6ea0c8e194c0ef', publishPort: 443, publishHost: 'https://admin.cloudapp-enterprise.appcelerator.com', username: 'williamtan89#hotmail.com', cookie: [ 'connect.sid=s%3A96v7wP3oaYbdV%2BLKu8IdiE3d.cjDf28RzrGOHQbxcd5507u4R STiRnGEO2SvwCG0zNtw; Path=/; Expires=Tue, 15 Dec 2015 05:58:21 GMT; HttpOnly' ],
defaultEP: { publishHost: 'https://admin.cloudapp-enterprise.appcelerator.com',
publishPort: 443 } } , checking nodeACSEndpoint= https://admin.cloudapp-enterprise.appcelerator.com Arrow Cloud cookie expiry [ 1450159101000 ] session already loaded in opts.session getCredentials() session: { "ipaddress": "10.238.179.133", "username": "williamtan89#hotmail.com", "password": "<OMITTED>", "session": "<OMITTED>", "nonce": "<OMITTED>", "environment": {
"name": "production",
"isProduction": true,
"acsBaseUrl": "https://api.cloud.appcelerator.com",
"acsAuthBaseUrl": "https://secure-identity.cloud.appcelerator.com",
"nodeACSEndpoint": "https://admin.cloudapp-enterprise.appcelerator.com" }, "token": "<OMITTED>", "fingerprint": "ce9aca6f8de18937ab3063f00c6ea0c8e194c0ef", "fingerprint_description": "Windows Machine ID: b250f9d4-0356-48cd-b9fb-d67ac86e7802", "org_id": 100032901, "expiry": 1449554288096 } noPlugins set for command "info" executing command "info" with no plugins "C:\Program Files\nodejs\node.exe" "C:\Users\User\.appcelerator\install\5.0.2\package\node_modules\appc-cli-titanium\node_modules\titanium\bin\titanium" sdk -o json checking for titanium, result: { activeSDK: '5.0.2.GA', defaultInstallLocation: 'C:\\ProgramData\\Titanium', installLocations: [ 'C:\\ProgramData\\Titanium',
'C:\\Users\\User\\AppData\\Roaming\\Titanium',
'C:\\ProgramData\\Application Data\\Titanium' ], installed: { '5.0.2.GA': 'C:\\ProgramData\\Titanium\\mobilesdk\\win32\\5.0.2.GA',
'5.0.0.v20150920231514': 'C:\\ProgramData\\Titanium\\mobilesdk\\win32\\5.0.0.v20150920231514',
'4.1.1.v20150816214206': 'C:\\ProgramData\\Titanium\\mobilesdk\\win32\\4.1.1.v20150816214206',
'3.2.3.GA': 'C:\\Users\\User\\AppData\\Roaming\\Titanium\\mobilesdk\\win32\\3.2.3.GA' }, sdks: { '5.0.2.GA':
{ name: '5.0.2.GA',
manifest: [Object],
path: 'C:\\ProgramData\\Titanium\\mobilesdk\\win32\\5.0.2.GA' },
'5.0.0.v20150920231514':
{ name: '5.0.0.v20150920231514',
manifest: [Object],
path: 'C:\\ProgramData\\Titanium\\mobilesdk\\win32\\5.0.0.v20150920231514' },
'4.1.1.v20150816214206':
{ name: '4.1.1.v20150816214206',
manifest: [Object],
path: 'C:\\ProgramData\\Titanium\\mobilesdk\\win32\\4.1.1.v20150816214206' },
'3.2.3.GA':
{ name: '3.2.3.GA',
manifest: [Object],
path: 'C:\\Users\\User\\AppData\\Roaming\\Titanium\\mobilesdk\\win32\\3.2.3.GA' } } } cmd [ '/s', '/c', 'node', 'C:\\Users\\User\\.appcelerator\\install\\5.0.2\\package\\node_modules\\appc-cli-titanium\\node_modules\\titanium\\bin\\titanium', 'info', '--color', '--config', '{"cli":{"colors":true}}' ] Titanium Command-Line Interface, CLI version 5.0.4, Titanium SDK version 5.0.2.GA Copyright (c) 2012-2015, Appcelerator, Inc. All Rights Reserved.
Please report bugs to http://jira.appcelerator.org/
8
ERROR | Error: titanium exited with exit code 8. re-run with -l trace to get detailed output
at ChildProcess.<anonymous> (C:\Users\User\.appcelerator\install\5.0.2\package\lib\commands\info.js:35:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Socket.<anonymous> (child_process.js:956:11)
at Socket.EventEmitter.emit (events.js:95:17)
at Pipe.close (net.js:465:12)
Please clean your project and build it again.

Categories

Resources