casidiablo / multidex

Library Project including compatibility multi dex loader.
https://github.com/casidiablo/multidex
Other
291 stars 54 forks source link

dx script #1

Closed vikky49 closed 9 years ago

vikky49 commented 10 years ago

Hi this is really not an issue but i am trying to just reach out to u ..Can u also publish on how to modify that dx script ..so that we can easily be able to port it in our projects..

RIght now i have used maven latest plugin .I got the mutlidex thing working but while trying to install i keep getting

Failure [INSTALL_FAILED_DEXOPT]

D/dalvikvm(17017): [Heap setting] startSize = 2 MB, maximumSize = 16 MB, growthlimit = 16 MB E/dalvikvm(17017): ERROR: unrecognized magic number (50 4b 03 04) E/dalvikvm(17017): ERROR: Byte swap + verify failed E/dalvikvm(17017): Optimization failed W/installd( 388): DexInv: --- END '/data/app/com.vcast.mediamanager-1.apk' --- status=0xff00, process failed E/installd( 388): dexopt in='/data/app/com.vcast.mediamanager-1.apk' out='/data/dalvik-cache/data@app@com.vcast.mediamanager-1.apk@classes.dex' res=65280 W/PackageManager( 996): Couldn't delete native library directory /data/app-lib/com.vcast.mediamanager V/PackageManager( 996): File /data/app/vmdl-1515185058.tmp changed: 40 V/PackageManager( 996): Ignoring change of non-package file: /data/app/vmdl-1515185058.tmp V/PackageManager( 996): File /data/app/com.vcast.mediamanager-1.apk changed: 80 V/PackageManager( 996): ignoreCodePath W/PackageManager( 996): Package couldn't be installed in /data/app/com.vcast.mediamanager-1.apk V/WallpaperService( 996): WallpaperObserver onEvent ev=8 path=package-restrictions.xml D/WallpaperService( 996): changedFile=/data/system/users/0/package-restrictions.xml V/PackageManager( 996): File /data/app/com.vcast.mediamanager-1.apk changed: 200 V/PackageManager( 996): ignoreCodePath V/WallpaperService( 996): WallpaperObserver onEvent ev=512 path=package-restrictions-backup.xml D/WallpaperService( 996): changedFile=/data/system/users/0/package-restrictions-backup.xml V/PackageManager( 996): + starting restore round-trip 48 V/PackageManager( 996): No restore - queue post-install for 48 I/PackageManager( 996): Trying to unbind DefaultContainerService V/Perf (16243): com.android.defcontainer.DefaultContainerService@41a8c000 onUnBind, 0ms V/Perf (16243): com.android.defcontainer.DefaultContainerService@41a8c000 onDestroy, 0ms V/PackageManager( 996): Handling post-install for 48 I/PackageManager( 996): mcs_unbind I/PackageManager( 996): calling disconnectService() V/ActivityManager( 996): unbindService: conn=442b5ff8 pid=996 D/dalvikvm( 996): GC_EXPLICIT freed 6265K, 27% free 45349K/61284K, paused 8ms+31ms, total 239ms D/IPCThreadState(16966): **\ STOPPING PROCESS D/AndroidRuntime(16966): Shutting down VM

Any thoughts? Ideas? Suggestions are greatly appreciated ..

casidiablo commented 10 years ago

Post the content of the dx file that is being used to generate the .dex files

vikky49 commented 10 years ago

@casidiablo Here u go ..Is this what u are looking for ..

prog="$0"
while [ -h "${prog}" ]; do
    newProg=`/bin/ls -ld "${prog}"`
    newProg=`expr "${newProg}" : ".* -> \(.*\)$"`
    if expr "x${newProg}" : 'x/' >/dev/null; then
        prog="${newProg}"
    else
        progdir=`dirname "${prog}"`
        prog="${progdir}/${newProg}"
    fi
done
oldwd=`pwd`
progdir=`dirname "${prog}"`
cd "${progdir}"
progdir=`pwd`
prog="${progdir}"/`basename "${prog}"`
cd "${oldwd}"

jarfile=dx.jar
libdir="$progdir"

if [ ! -r "$libdir/$jarfile" ]; then
    # set dx.jar location for the SDK case
    libdir="$libdir/lib"
fi

if [ ! -r "$libdir/$jarfile" ]; then
    # set dx.jar location for the Android tree case
    libdir=`dirname "$progdir"`/framework
fi

if [ ! -r "$libdir/$jarfile" ]; then
    echo `basename "$prog"`": can't find $jarfile"
    exit 1
fi

defaultMx="-Xmx1024M"

javaOpts=""

while expr "x$1" : 'x-J' >/dev/null; do
    opt=`expr "x$1" : 'x-J\(.*\)'`
    javaOpts="${javaOpts} -${opt}"
    if expr "x${opt}" : "xXmx[0-9]" >/dev/null; then
        defaultMx="no"
    fi
    shift
done

if [ "${defaultMx}" != "no" ]; then
    javaOpts="${javaOpts} ${defaultMx}"
fi

if [ "$OSTYPE" = "cygwin" ]; then
    # For Cygwin, convert the jarfile path into native Windows style.
    jarpath=`cygpath -w "$libdir/$jarfile"`
else
    jarpath="$libdir/$jarfile"
fi

exec java $javaOpts -jar "$jarpath" "$@"
casidiablo commented 10 years ago

I see... you have to read the README https://github.com/casidiablo/multidex It says what to edit.

Here is how it looks mine: exec java $javaOpts -jar "$jarpath" --multi-dex "$@"

DavidPerezIngeniero commented 10 years ago

Mine looks like so:

exec java $javaOpts -jar "$jarpath" --multi-dex --main-dex-list=/path/multidex.txt "$@"
sschuberth commented 9 years ago

As of PR #3 patching of the script that calls dx should not be necessary anymore.

sschuberth commented 9 years ago

Closing this as the README file was updated with instructions on how to modify the build.gradle file instead of patching the dx script.