Android DexClassLoader - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android DexClassLoader class.

This code example shows how to use the following methods:
This code example shows how to use the following methods:loadClass
            throws ClassNotFoundException { 
        // This kind of reflection is expensive, so let's only do it 
        // if we need to 
        Class<?> klass = sClassMap.get(packageName);
        if (klass == null) {
            DexClassLoader classLoader = new DexClassLoader(
                    sourceDir, "/data/local/tmp",
                    null, ClassLoader.getSystemClassLoader());
            klass = classLoader.loadClass(packageName + ".R$id");
            sClassMap.put(packageName, klass);
        } 
        return klass;
    } 
 
    private static AccessibilityNodeInfo getNodeByAccessibilityIds(
            String windowString, String viewString) {
        int windowId = Integer.parseInt(windowString);
        int viewId = Integer.parseInt(viewString);
        int connectionId = sUiTestAutomationBridge.getConnectionId();
        AccessibilityInteractionClient client = AccessibilityInteractionClient.getInstance();
6
CodeRank
This code example shows how to use the following methods:loadClass
 
	    try { 
		final File optimizedDexOutputPath = getDir("outdex",
			Context.MODE_PRIVATE);
		// On charge le plugin 
		DexClassLoader cl = new DexClassLoader(
			this.file.getAbsolutePath(),
			optimizedDexOutputPath.getAbsolutePath(), null,
			getClassLoader());
		// On instancie la classe du plugin 
		Class<?> libClass = cl.loadClass(this.classname);
		// PluginInterface lib = (PluginInterface) 
		// libClass.newInstance(); 
		// // lib.run(this.ctx, this.layout); 
 
	    } catch (Exception e) {
		e.printStackTrace();
	    } 
 
	} 
5
CodeRank
This code example shows how to use the following methods:loadClass
    public static final int eAM_STATUS_USURP_FAILURE = 13;
 
    private AuthentecHelper(Context ctx)
    { 
        try { 
            AuthentecMobile = sAuthentecClassLoader.loadClass("com.authentec.amjni.AuthentecMobile");
            TSM = sAuthentecClassLoader.loadClass("com.authentec.amjni.TSM");
            Constructor ctor = AuthentecMobile.getDeclaredConstructors()[0];
            am = ctor.newInstance(ctx);
        } catch (Exception ex) {
            ex.printStackTrace();
            return; 
        } 
    } 
 
    public int fingerprintUnlock(String sScreen, Context ctx) {
        int iResult = 0;
 
        try { 
            if (! (Boolean) AuthentecMobile.getMethod("AM2ClientLibraryLoaded").invoke(am)) {
5
CodeRank
This code example shows how to use the following methods:
            tmp.mkdirs();
        } 
 
        @Override 
        public ClassLoader getClassLoader(URL url, ClassLoader parent) {
            return new DexClassLoader(url.getPath(), tmp.getAbsolutePath(),
                    null, parent);
        } 
    } 
 
    /** 
     * Implementation for the reference implementation. Nothing interesting to 
     * see here. Please get along. 
     */ 
    static class RefImpl extends Support_ClassLoader { 
        @Override 
        public ClassLoader getClassLoader(URL url, ClassLoader parent) {
            return new URLClassLoader(new URL[] { url }, parent);
        } 
    } 
5
CodeRank
This code example shows how to use the following methods:
		return PathCurrentPackage()+"/extract"; 
	} 
 
	public DexClassLoader getClassLoader(){
		Log.d(TAG,"PathCurrentPackage ="+PathCurrentPackage()+"/"+getCurrentPackage()+".jar, ODEX path="+this._tmpDIR.getAbsolutePath());
		return new DexClassLoader(PathCurrentPackage()+"/"+getCurrentPackage()+".jar",this._tmpDIR.getAbsolutePath(), null, this.getClass().getClassLoader());
	} 
 
} 
3
CodeRank
This code example shows how to use the following methods:
            tmp.mkdirs();
        } 
 
        @Override 
        public ClassLoader getClassLoader(URL url, ClassLoader parent) {
            return new DexClassLoader(url.getPath(), tmp.getAbsolutePath(),
                    null, parent);
        } 
    } 
 
    /** 
     * Implementation for the reference implementation. Nothing interesting to 
     * see here. Please get along. 
     */ 
    static class RefImpl extends Support_ClassLoader { 
        @Override 
        public ClassLoader getClassLoader(URL url, ClassLoader parent) {
            return new URLClassLoader(new URL[] { url }, parent);
        } 
    } 
4
CodeRank
This code example shows how to use the following methods:
		 
		if (apkName != null && listenerClassName != null) {
			File file = new File(apkName);
			 
			if (file.exists() && !file.isDirectory()) {
				DexClassLoader classLoader = new DexClassLoader(file.getAbsolutePath(), context.getDir("dex", 0).getPath(), null, getClass().getClassLoader());
				 
				try { 
					clazz = (Class<? extends TestListener>) Class.forName(properties.getProperty(KEY_TEST_LISTENER_CLASS), true, classLoader);
				} catch (Exception e) {
					Log.e(TAG, "Unable to load class " + listenerClassName + " from apk file " + apkName + ".");
				} 
			} else { 
				Log.e(TAG, "apkFile does not exist or is a directory.");
			} 
		} else if (apkName == null) {
			Log.w(TAG, "apkFile not specified.");
		} else /* listenerClassName == null */ { 
			Log.w(TAG, "testListenerClass not specified.");
		} 
4
CodeRank
This code example shows how to use the following methods:
     * @return dex class loader instance with its classpath set to location 
     * indicated by {@code pathHolder} 
     */ 
    public ClassLoader getDexClassLoader(PathHolder pathHolder) {
        ClassLoader myLoader = DexClassLoaderHelper.class.getClassLoader();
        return new DexClassLoader(pathHolder.getJarFilePath(), pathHolder.getDirLocation(),
                null, myLoader);
    } 
} 
4
CodeRank
This code example shows how to use the following methods:
     * @return dex class loader instance with its classpath set to location 
     * indicated by {@code pathHolder} 
     */ 
    public ClassLoader getDexClassLoader(PathHolder pathHolder) {
        ClassLoader myLoader = DexClassLoaderHelper.class.getClassLoader();
        return new DexClassLoader(pathHolder.getJarFilePath(), pathHolder.getDirLocation(),
                null, myLoader);
    } 
} 
4
CodeRank

Related Android DexClassLoader Questions & Answers:

See Code Examples for Android DexClassLoader Methods: