Android :: Loading DEX Files At Runtime From SD Card
Feb 9, 2009
I would like my users to develop their own routines for image manipulation. Lets presume that a third party has written a class which implements one of my interfaces; public abstract class PixelBinaryFilter extends BinaryFilter{protected abstract int generatePixel(int p1, int p2);}
View 3 Replies
Mar 18, 2009
I am storing the required test.jar file in the /sdcard. I want to load it dynamically at runtime and want to execute a function xyz() resides in that. For this purpose I had written following code:
But got ClassCastException : dalvik.system.PathClassLoader
Following is my code ,
import java.io.File; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.URL; import java.net.URLClassLoader;
import android.app.Activity; import android.os.Bundle; import android.util.Log;
public class Collabera extends Activity {
/** Called when the activity is first created. */
private static final Class[] parameters = new Class[] { URL.class };
public static void loadURLClass(String classPathURL) throws IOException {
File f = new File(classPathURL);
URL url = f.toURL();
URLClassLoader systemLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();
Class systemLoaderClass = URLClassLoader.class;
try { Method method = systemLoaderClass.getDeclaredMethod("addURL", parameters);
method.setAccessible(true);
method.invoke(systemLoader, new Object[] { url });
} catch (Throwable t) { t.printStackTrace();
throw new IOException( "Error, could not add URL to system classloader");
} }
@Override
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Log.i("See","**************Before Loading Class Path**************");
try { Class.forName("test.Test1");
} catch (ClassNotFoundException e) { System.out.println(" Test Class Not Found ....");
} Log.i("See","**************After Loading Class Path**************");
try { loadURLClass("//sdcard//test.jar");
Class c = Class.forName("test.Test1");
Log.i("See"," Test Class Found ....");
Method method = c.getMethod("xyz", null);
Object o = c.newInstance();
String s = (String) method.invoke(o);
Log.i("See","Got method: " + s);
} catch (ClassNotFoundException e) { System.out.println(" Test Class Not Found ....");
} catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace();
} } }
View 9 Replies
View Related
Jul 29, 2013
I am using and android 2.2 phone for testing and getting an error.
07-27 01:24:55.692: W/System.err(14319): java.lang.ClassNotFoundException: com.shoaib.AndroidCCL.MyClass in loader dalvik.system.DexClassLoader@43abbc20
First I wrote the following class:
Code:
package org.shoaib.androidccl;
import android.util.Log;
public class MyClass {
public MyClass() {
Log.d(MyClass.class.getName(), "MyClass: constructor called.");
}
public void doSomething() {
Log.d(MyClass.class.getName(), "MyClass: doSomething() called.");
}
}
And I packaged it in a DEX file that I saved on my device's SD card as `/sdcard/testdex.jar`.
Then I wrote the program below, after having removed `MyClass` from my Eclipse project and cleaned it:
Code:
public class Main extends Activity {
[MENTION=1299008]supp[/MENTION]ressWarnings("unchecked")
[MENTION=439709]override[/MENTION]
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
[code]....
View 2 Replies
View Related
Oct 16, 2009
How we can store image files(*.png) to the folder R.drawable at runtime?
View 2 Replies
View Related
Mar 15, 2010
I have a button that plays an audio file on its click listener. If the button is clicked again and again while the audio file is being played then the app crashes. What's the solution?
Here is some code for reference...
View 1 Replies
View Related
Jan 11, 2010
I'm using the Android Development Toolkit (ADT) in Eclipse Galileo. I've created a project in which to develop some util classes, which I intend to use in several upcoming Android projects. However, when I come to use these util classes (deployed as a jar and included in the Android project as a user library), I get a java.lang.VerifyError during the startup of the emulator. Can I force the verification of these library files, or do I need to include them as part of the Android project, and not as an external jar?
View 3 Replies
View Related
Jul 8, 2010
I'm loading html into a webview from my assets folder, works no problem. In my second experiment I've loaded HTML from a database (after pulling from remote source) and displayed in a webview (also no prob). Now I'm trying to change the baseref inside the html to have all JS and CSS references point to source files under assets. This part doesn't seem to work. I get warnings from the web console that it can't load these files due to security issue.
Now I've resorted back to a content provider and overriding openFile (and setting base ref with content://...) but now I'm hitting another problem with the JS and CSS files in assets being compressed. Can load html from assets but loading JS, CSS from within that HTML is another story. Before I dig deeper, am I over-complicating this?
View 3 Replies
View Related
Oct 12, 2010
I have a .swf file and i want to open it into webview and also wanna play flash games loaded there in webview.
View 1 Replies
View Related
Mar 19, 2009
I wrote an app that downloads web sites and all their assets (images/stylesheets) to "disk" and therefore stores lots of small files on the SD card.
Sometimes it fails to delete large amounts of files and afterward the file system is r/o. To analyze that behavior I tried to do the removal of the files by hand and then go from there. But that already failed.
localhost:~ mkamp$ adb -d shell mount [.. some mounts ..] /dev/block/mmcblk0p1 /sdcard vfat rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1000,fmask=0711,dmask=0700,codepage=cp437,iocharset=iso8859-1,utf8 0 0 --> R/W
Last login: Wed Mar 18 19:41:49 on ttys005 localhost:~ mkamp$ adb -d shell rm /sdcard/newsrob/a* [.. minutes of silent deletes ..] rm failed for /sdcard/newsrob/a2aade03616c28b30_113.png, Read-only file system localhost:~ mkamp$
localhost:~ mkamp$ adb -d shell mount [.. some mounts ..] /dev/block/mmcblk0p1 /sdcard vfat ro,dirsync,nosuid,nodev,noexec,uid=1000,gid=1000,fmask=0711,dmask=0700,codepage=cp437,iocharset=iso8859-1,utf8 0 0 --> R/O now
The log contained nothing but the usual gc output and random WiFi status changed mumbo jumbo.
Anybody else seeing this behavior?
There were 6.500 files in that directory. Might that be the problem? I don't access the files with queries, I always have the exact name.
View 5 Replies
View Related
Apr 21, 2009
Is is possible to load/install apps by simply putting the APK file on a SD Card?
I'm trying to figure out a way to preinstall apps (prior to handing them out i mean) in a large corporate environment without the need of going though Marketyplace.
I know I can point the device to an APK file on the web and do an install that way, but I'm looking for a way to preinstall the app in a more expedited way. Ideally, writing this onto SD and poping in the Card into each device is ideal in our setup. Is this possible? Any suggestions?
View 2 Replies
View Related
Nov 22, 2013
I have one bitmore 1010 tablet with custom rom cyanogedmod, I delete some files from root directory and now the tablet is not load android os. I see only the bitmore image in screen and nothing else.
can I restore the image from android control v1.3.1?
View 1 Replies
View Related
Jan 19, 2009
How to load simple html file present in sd mmc card from web browser. It is mentioned in the net that due to security reasons this is not allowed. Is there any way to access the file from sdcard? Tried modifying private String homeUrl =
"file:///sdcard/index.html";
in BrowserSettings.java file but browser throws an error "could not be loaded".
View 4 Replies
View Related
Mar 19, 2014
My Sandisc 64GB SD card went kaputt last week, it froze at 33GB, luckily the existing files are all ok and I was able to copy all the files onto my PC, however nothing new can be written to it. I've tried formatting with no success. So I copied the files onto the PC and just got a new this time Samsung 64GB micro SD card. Problem I'm having now is that on several attempts it's failed to copy the files back to my SD card (from PC) I've formatted the card in the Note 3..the music files about 4 GB transferred just fine, the problem seems to be with the Pix and Videos. I'm currently trying to copy the DCIM folder back onto the micro sd and it's saying it'll take 6 hours.
I have tried: copying from PC to micro SD in the phone via USB copying from PC to micro SD in SD card adapter plugged directly into PC
copying from PC to micro SD in USB adapter plugged into PC
all results the same
View 1 Replies
View Related
Aug 18, 2010
I think this issue is correlated directly to the SD card that comes with our phone... but it seems to be quite slow. I say this, because I notice quite often that my music has short to medium pauses between tracks (off the SD), and if I do anything else while it's playing back, like say.... downloading something through the browser (I use Dolphin, everything is set to save onto SD as well as the cache) my music will skip and jump mid-playback. It's been like this since I got it, and it's been getting worse the more stuff I put onto it. I know that it's normal for any storage drive's write/read speeds to drop proportionately as the free space is taken up by data, but it's starting to become an issue with what I would consider 'normal' usage. The SD card we got with the phone is only a Class 2, but I've yet to have these kinds of problems with any other class 2 cards. Should I get a Class 4 or 6 and see if it fixes the problem? (money isn't really an issue, I just don't want to be paying $115 for an SD card. Hell, I could get a 500gb HDD for my computer at that price!)
View 1 Replies
View Related
Mar 2, 2009
1) I am developing my app in Eclipse 3.4.1 with Android (ver 1.1_r1) plugin. My app compiles and executes without errors when using the Eclipse IDE.
However, when I export my app (unsigned) using Eclipse (via {select project} >right-click>Android tools>export unsigned application package), sign it, and try to run it on the Emulator, it throws a runtime error when I try to update my sqlite database, at which time the specific error created is: SQLite error#14, unable to open database. It is able to read from the database without problems. (I have also verified that the database is: open, is not readonly, is not locked by another thread, is not in the middle of a transaction.)
I have limited experience, but this seems more like a "system" problem given that the app works OK in Eclipse IDE but then fails as an exported/signed apk. Some googling of SQLite resources revealed a similar error on a non-Android platform which was fixed by: "Set your permissions correctly on /var/tmp, or whatever directory you are using to hold temporary files".
Does Android have temporary files, and if so how does it handle permissions on temporary files? Is there a way to check or set these permissions to see if this fixes my problem here?
2) Not sure if it is related, but after I have run the exported/signed app which causes the runtime error, if I reboot the Emulator, and try to run the program using the Eclipse IDE , the program fails with the same exact error. PLUS I also noticed the following error message while the program is installing/running: 03-01 22:22:29.282: ERROR/PackageManager(53): Package com.northwestradiology has mismatched uid: 0 on disk, 10019 in settings; read messages:
I can restore the Eclipse version of my program to be able to execute without runtime errors by utilizing the -wipe-data option for the emulator. But note that if I run my signed APK using an emulator created with the -wipe-data option, it still throws the runtime error listed above...
View 2 Replies
View Related
Dec 7, 2011
I just picked up a new 32 GB micro SD card for my infuse and at first I had trouble getting anything to read it, but it turned out to be something with the directories (specifically my mp3 player).
But now half of my apps won't get past the "loading" status and I imagine it's because some of the data is on the old SD card. They do load just fine when I have that in. I tried copying everything over to the new card, then tried formatting the card and copying everything over again and no luck. If I re-download one of those apps, it seems to keep my settings. I wouldn't mind re-downloading them all except that I can't even see the names of the apps on the home screen (just says loading) and I can't remember everything.
View 3 Replies
View Related
Jan 8, 2013
My question is can you load the digital copy movies that come with dvds onto windows media player on your pc then copy onto your sd card? Is it mp4 format or an unsupported file type? Or are the digital copies strictly for itunes and psp?
Galaxy Note 2
View 2 Replies
View Related
May 4, 2009
I want to display a fancy 'loading' image at my app's startup time.
The problem: my startup code is mostly GUI related, hence needs to run on UI thread.
Is there a way to do both - that is run UI-related code on UI thread while an image is displayed to the user?
View 8 Replies
View Related
Sep 15, 2010
My application needs to do some clean up. I need to list the files such as "ls voice*.amr", and then delete those files. How could I do it in Android?
View 7 Replies
View Related
Oct 24, 2008
I think we really need a file manager for the g1 so that we have a single app to access all the file on the internal or sd memory instead of going to each appropriate program for the files wanting access to.Secondly, what are the requirement for files on the sd card? Do they all have to be jumbled together in the root directory or can the be organized into folders and still be found by the programs?
View 8 Replies
View Related
Sep 15, 2010
I cannot create directories and files on sd card.
This is the simple example:
code:.................
View 2 Replies
View Related
Feb 2, 2010
I'm a beginner in Android and request any help on the following. I'm trying to use an SD Card loaded on to the Emulator and store files pro grammatically. The code snippet is as below public class Down loader { public Down loader(String path){ this.path=sanitize(path); Log.d("DEBUG","The File Path is " + path);}
View 11 Replies
View Related
Sep 27, 2010
I have an app which stores some files on the SD Card. After several uninstall and install, sometimes, the files just got deleted. Is that normal for android os to do that? What should I do to make sure that those files won't be deleted automatically?
View 2 Replies
View Related
Jul 16, 2010
I have a Motorola Droid, it is not rooted and I am currently in a deployed location and have no service/access to any networks. My phone got a little wet, but still works for the most part and I want to factory reset it without losing my apps/music/contacts/pictures etc. Is there a way to move all of this stuff to the SD card using and explorer straight from the phone without using a computer? I am out of options.
View 2 Replies
View Related
Oct 22, 2010
I havent been able to find the zip or rar files my phone downloads (or at least I think it has downloaded) through the Browser app.
THe very first time I tried this it worked fine. i downloaded a zip file from filestube and it immediately showed up in the notification bar that it was downloading. When it was done i clicked the notification and i unzipped it with androzip or something like that. Worked like a charm...
But now i have tried many times, and i never get any confirmation that any download has begun in the notification bar or anything. The only thing that leads me to believe that some download is actually taking place is that, for instance, if iam downloading from megaupload, if i click the download button 2x it will take me to window saying that "this i.p address is already downloading a file".
But i cant find any evidence of this on the phone? I have looked through all the folders on the sd card, but no luck.
View 6 Replies
View Related
Aug 19, 2009
Can we assume that App can write to /sdcard some file? What can be reason one cannot do that? I could not find any documentation on sdcard rules in google docs.
View 6 Replies
View Related
Sep 15, 2010
I'm happy reading and writing to a pre-set file, and could manually populate a listview, but I'm hoping there is an official(or not) filebrowser I missed, or other more elegant solution to present the user with a directory listing, and let them select a file.
View 2 Replies
View Related
Jul 10, 2010
Using code from open source MusicDroid with the following code that I found during a search for this problem, I can only get mp3 files that are in the root directory /sdcard/
CODE:........
How can I get all the mp3 files from the card (in any directory) into my 'songs' list?
View 1 Replies
View Related
Feb 7, 2009
I'm writing an podcast playing application. The application has pre- defined feeds but I want to cache the image of the feed for 30 days. However, on the initial creation of the podcast I am downloading the image, and trying to save it to the SD card using the code below:
CODE:............................
However, it keeps failing on the line k.createNewFile(); with the error: WARN/System.err(10727): java.io.IOException: Parent of file is not a directory: /sdcard/twitcast/1.jpg
I've checked and I have write permission and the SD card is mounted, and I have android.permission.MOUNT_UNMOUNT_FILESYSTEMS included in my manifest. why this keeps failing?
View 3 Replies
View Related
Jan 16, 2010
Anyone know an app like " Idisk" from iphone. The app only open a port and ip to transfer files from and to the SD CARD to PC.. Anyone know if there are a application for this?
View 9 Replies
View Related