I have a very simple command line Java application that I wish to port to the Android platform. What the application does is to access a webpage on the Internet and print some output via System.out.println.
From http://davanum.wordpress.com/2007/12/04/command-line-java-on-dalvikvm/, I realise that I can convert my Java application’s jar file to Android dex format and subsequently to Android jar file which can then be run using dalvikvm.
However, after I’ve done that and have successfully executed the program on my Android phone, I got the following error:
java.net.SocketException: Permission denied
I reckoned it must be due to the application having no permission to access the Internet, as a typical Android apk application would contain a AndroidManifest.xml file which can specify permissions such as:
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
So here I am, seeking answers on whether I can avoid building a full-fledged apk application by somehow specifying that I need the internet access permission somewhere during the process of getting ready the android jar file or at execution via dalvikvm?
I think the issue is that the default shell user (which is what you are if you are running
adb shell) may not have INTERNET permission. Since I don’t think there’s a simple way to add permissions to a user on the command line I’m not sure you’ll be able to do this at all.