Cannot use dex2jar on my mac: permission denied - android

I downloaded dex2jar and now trying to use it, but if I type 'sh d2j-dex2jar.sh' it shows the following message.
d2j-dex2jar.sh: line 36: ./d2j_invoke.sh: Permission denied
At first I thought that the permission was denied because the programme required the root permission, so I also tried adding 'sudo' to the command, and it did not work either. How should I solve this problem?

You need to provide execute permissions to your sh script.
To do that : sudo chmod +x d2j_invoke.sh

Still If you find no luck use,
chmod a+x *.sh

Related

Unable to log into file using logcat running from script as a service in AOSP 5.1

I am trying to log to a file from custom shell script started as service using init.project.rc. On using below lines in the script(ethmon.sh), i am unable to log it to file test.txt. It is not even creating the file. Any hints on this?
ethmon.sh
mkdir /data/local/tmp/test 2>/dev/null
echo "Issue Observed with IP at `date`" >> /data/local/tmp/test/test.txt
dmesg >> /data/local/tmp/test/test.txt
timeout -t 10 logcat -v time -f /data/local/tmp/test/logcat.txt
init.project.rc
service ethmon /system/xbin/ethmon
class main
user root
group root
oneshot
on property:dev.bootcomplete=1
start ethmon
preload_script.sh
cp -f $SOURCE_FOLDER/ethmon.sh $OUT/system/xbin/ethmon
I am new to aosp, am i missing some permissions to be added for this.
NOTE: Other lines of code(ifconfig eth0 down/up, netcfg) is working fine in the same script.
Finally i added selinux permissions and created .te file for my service to get the log thing working. Thanks https://stackoverflow.com/users/12098405/dash-o for the help. People with same issue can comment for any further information.

Termux permission denied

I want to execute a simple code in Termux(c++) but every time I get an error:
bash: ./test.cpp: Permission denied
Storage permission is on and gcc is installed.
Do I need root or something else?
As molbdnilo said, you should compile your source file first :
g++ test.cpp
And then execute the binary produced (the default name is a.out)
./a.out
Compile and run it in termux's own directory.
Just start termux:
cd storage/
nano test.cpp
g++ test.cpp "./a.out"
You can run it!
C++ can't do it,you must compile first.
And if it Python,you can add #!/usr/bin/env python to first line,and in shell run chmod 744 xxx.py,and then run ./xxx.py.xxx.py is running.
I never used termux but would Like to suggest U following points for compiling
use chmod 777 test.cpp to grant the permission for read write and execute to all users
use g++ along with gcc to compile C++ files
use sudo apt-get update followed by sudo apt-get install g++
compile using g++ test.cpp -o test
and use ./test to execute the file.
This is how it work in Linux systems.

android modified su binary failes on setgid

I have created a custom su binary for testing purposes.
I have copied the binary to /system/xbin/mod_su
I have changed the files permissions with chmod 6755 /system/xbin/mod_su,
but still when I run the binary as a non-root user I fail on setgid(0) with 'Operation not permitted1'
Any ideas why this could happen ?
isn't 6755 permmisons enough ?
Did you chown root.root it before chmod?
Apart from chown you can also try
chmod 4755
The 4 specifies set user ID which can be the reason for the error.

bash: ./studio.sh: Permission denied (error installing Android-Studio)

While I was trying to Install Android-Studio
and execute the command
#abhinay-Pc:/android-studio/bin$`./studio.sh
It is showing the error:
bash: ./studio.sh: Permission denied
I have already exported Java directory to /android-studio/bin folder`
(Java_Home = /usr/lib/jvm/java-7-oracle)
I have the java-7 installed on my system.
You might not have chmod +x studio.sh try sh ./studio.sh
If this was not it, try again like this: sh -x ./studio.sh. This will show you every line that is run and will help you debug it.
Good luck.
you must change the properties of the studio.sh file and change in the permission to Allow this file to run as program

cocos2d-2.0-rc2-x-2.0.1 Hello World sample doesn't work using cygwin on windows8

I am unable to build helloWorld sample to get .so to run it in eclipse. I have imported project successfully and changed variable to my root path as required. this is my build_native.sh. I am pasting the only change I made in that file
NDK_ROOT_LOCAL=/cygdrive/e/android-ndk-r8
COCOS2DX_ROOT_LOCAL=/cygdrive/e/cocos2d
And my NDK is working fine because I have executed HelloWorld sample of NDK successfully. My SDK version is 20 and NDK version is 8 and I am using cygwin above than 1.7.. I have executed the chown on my NDK directory.. But when I run the command ./build_native.sh in HelloWorld sample program for cocos2d I get this error
E:/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/../lib/gcc/arm- linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/png.a: No such file: Permission denied
collect2: ld returned 1 exit status
and when I search for png.a in my NDK directory window can't locate that file. I am confused whether it's a permission error or File isn't there. But I have the latest NDK if file isn't there how come anyone will able to run cocos2d-x??? Need Help!!!
It seems like the permissions on built files were missing when I tried as well.
$ ls -l obj/local/armeabi/png.a
---------- 1 someuser Domain Users 912618 Jul 12 18:23 obj/local/armeabi/png.a
There is a link suggested on the forum which doesn't seem to be accessible right now.
Anyway, to fix, you can set the permission on the files.
$ cd obj/local/armeabi/
$ chmod 664 *.a
$ cd ../../..
Edit: A better fix may be to set the default permissions in /etc/fstab to
none /cygdrive cygdrive binary,noacl,posix=0,user 0 0
Following this, you should be able to run ./build_native.sh.
A command you could use to locate all files below the current directory which have no (read/write) permission available on them is find . -type f -perm 0
See this answer to set write permissions on all files below your working directory.
Consider going through a tutorial on chmod to understand the concept of permissions in linux/unix in case you're unfamiliar with them.

Categories

Resources