Code Monkey home page Code Monkey logo

android-diffpatch's Introduction

android-diffpatch

diffpatch with android

Getting Started

BsDiffPatch

website: http://www.daemonology.net/bsdiff/

  1. write in the build.gradle as follows:
sourceSets {
    main {
        jniLibs.srcDirs = ['libs']
    }
}
  1. copy app/libs/armeabi-v7a/libbsdiffpatch.so to your project.
  2. copy app/src/main/java/com/github/snowdream/bsdiffpatch and app/src/main/java/com/github/snowdream/diffpatch to your project, with the exact package and filename.

HDiffPatch

website:https://github.com/sisong/HDiffPatch

  1. write in the build.gradle as follows:
sourceSets {
    main {
        jniLibs.srcDirs = ['libs']
    }
}
  1. copy app/libs/armeabi-v7a/libhdiffpatch.so to your project.
  2. copy app/src/main/java/com/github/snowdream/hdiffpatch and app/src/main/java/com/github/snowdream/diffpatch to your project, with the exact package and filename.

Usage

BsDiffPatch

IDiffPatch bsDiffPatch = new BSDiffPatch();
bsDiffPatch.init(getApplicationContext()); 
//diff
bsDiffPatch.diff(oldFilePath, newFilePath, diffFilePath);
//patch
bsDiffPatch.patch(oldFilePath, diffFilePath, gennewFilePath);

HDiffPatch

IDiffPatch hDiffPatch = new HDiffPatch();
hDiffPatch.init(getApplicationContext()); 
//diff
hDiffPatch.diff(oldFilePath, newFilePath, diffFilePath);
//patch
hDiffPatch.patch(oldFilePath, diffFilePath, gennewFilePath);

License

Copyright (C) 2016 snowdream <[email protected]>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

android-diffpatch's People

Contributors

snowdream avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

android-diffpatch's Issues

直接运行该项目报错

java.lang.UnsatisfiedLinkError: Cannot load library: load_library(linker.cpp:766): not a valid ELF executable: /data/app-lib/com.china3s.android-1/libbsdiffpatch.so

solutions

error: 'runtime_error' is not a member of 'std'

20:20:33: Executing external task 'assembleArm7'...
Configuration on demand is an incubating feature.
Incremental java compilation is an incubating feature.
:app:compileHello-jniArmeabi-v7aDebugSharedLibraryHello-jniMainC
:app:linkHello-jniArmeabi-v7aDebugSharedLibrary
:app:hello-jniArmeabi-v7aDebugSharedLibrary
:app:stripSymbolsArmeabi-v7aDebugSharedLibrary
:app:ndkBuildArmeabi-v7aDebugSharedLibrary
:app:ndkBuildArmeabi-v7aDebugStaticLibrary UP-TO-DATE
:app:androidArm7Debug
:app:preBuild UP-TO-DATE
:app:preArm7DebugBuild UP-TO-DATE
:app:checkArm7DebugManifest
:app:prepareArm7DebugDependencies
:app:compileArm7DebugAidl
:app:compileArm7DebugRenderscript
:app:generateArm7DebugBuildConfig
:app:mergeArm7DebugShaders
:app:compileArm7DebugShaders
:app:generateArm7DebugAssets
:app:mergeArm7DebugAssets
:app:generateArm7DebugResValues UP-TO-DATE
:app:generateArm7DebugResources
:app:mergeArm7DebugResources
:app:processArm7DebugManifest
:app:processArm7DebugResources
:app:generateArm7DebugSources
:app:incrementalArm7DebugJavaCompilationSafeguard
:app:compileArm7DebugJavaWithJavac
:app:compileArm7DebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
:app:compileArm7DebugSources
:app:prePackageMarkerForArm7Debug
:app:transformClassesWithDexForArm7Debug
To run dex in process, the Gradle daemon needs a larger heap.
It currently has approximately 910 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to more than 2048 MB.
To do this set org.gradle.jvmargs=-Xmx2048M in the project gradle.properties.
For more information see https://docs.gradle.org/current/userguide/build_environment.html
:app:mergeArm7DebugJniLibFolders
:app:transformNative_libsWithMergeJniLibsForArm7Debug
:app:processArm7DebugJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForArm7Debug
:app:validateDebugSigning
:app:packageArm7Debug
:app:zipalignArm7Debug
:app:assembleArm7Debug
:app:compileHello-jniArmeabi-v7aReleaseSharedLibraryHello-jniMainC
:app:linkHello-jniArmeabi-v7aReleaseSharedLibrary
:app:hello-jniArmeabi-v7aReleaseSharedLibrary
:app:stripSymbolsArmeabi-v7aReleaseSharedLibrary
:app:ndkBuildArmeabi-v7aReleaseSharedLibrary
:app:ndkBuildArmeabi-v7aReleaseStaticLibrary UP-TO-DATE
:app:androidArm7Release
:app:preArm7ReleaseBuild UP-TO-DATE
:app:checkArm7ReleaseManifest
:app:prepareArm7ReleaseDependencies
:app:compileArm7ReleaseAidl
:app:compileArm7ReleaseRenderscript
:app:generateArm7ReleaseBuildConfig
:app:mergeArm7ReleaseShaders
:app:compileArm7ReleaseShaders
:app:generateArm7ReleaseAssets
:app:mergeArm7ReleaseAssets
:app:generateArm7ReleaseResValues UP-TO-DATE
:app:generateArm7ReleaseResources
:app:mergeArm7ReleaseResources
:app:processArm7ReleaseManifest
:app:processArm7ReleaseResources
:app:generateArm7ReleaseSources
:app:incrementalArm7ReleaseJavaCompilationSafeguard
:app:compileArm7ReleaseJavaWithJavac
:app:compileArm7ReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
:app:compileArm7ReleaseSources
:app:lintVitalArm7Release
:app:prePackageMarkerForArm7Release
:app:transformClassesWithDexForArm7Release
:app:mergeArm7ReleaseJniLibFolders
:app:transformNative_libsWithMergeJniLibsForArm7Release
:app:processArm7ReleaseJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForArm7Release
:app:packageArm7Release
:app:assembleArm7Release
:app:assembleArm7
:bsdiffpatch:compileBsdiffpatchArmeabi-v7aDebugSharedLibraryBsdiffpatchMainC
:bsdiffpatch:linkBsdiffpatchArmeabi-v7aDebugSharedLibrary
:bsdiffpatch:bsdiffpatchArmeabi-v7aDebugSharedLibrary
:bsdiffpatch:stripSymbolsArmeabi-v7aDebugSharedLibrary
:bsdiffpatch:ndkBuildArmeabi-v7aDebugSharedLibrary
:bsdiffpatch:ndkBuildArmeabi-v7aDebugStaticLibrary UP-TO-DATE
:bsdiffpatch:androidArm7Debug
:bsdiffpatch:compileLint
:bsdiffpatch:copyArm7DebugLint UP-TO-DATE
:bsdiffpatch:preBuild UP-TO-DATE
:bsdiffpatch:preArm7DebugBuild UP-TO-DATE
:bsdiffpatch:checkArm7DebugManifest
:bsdiffpatch:preArm7DebugAndroidTestBuild UP-TO-DATE
:bsdiffpatch:preArm7DebugUnitTestBuild UP-TO-DATE
:bsdiffpatch:preArm7ReleaseBuild UP-TO-DATE
:bsdiffpatch:preArm7ReleaseUnitTestBuild UP-TO-DATE
:diffpath:androidRelease UP-TO-DATE
:diffpath:compileLint
:diffpath:copyReleaseLint UP-TO-DATE
:diffpath:mergeReleaseProguardFiles UP-TO-DATE
:diffpath:packageReleaseRenderscript UP-TO-DATE
:diffpath:preBuild UP-TO-DATE
:diffpath:preReleaseBuild UP-TO-DATE
:diffpath:checkReleaseManifest
:diffpath:prepareReleaseDependencies
:diffpath:compileReleaseRenderscript
:diffpath:generateReleaseResValues UP-TO-DATE
:diffpath:generateReleaseResources
:diffpath:packageReleaseResources
:diffpath:compileReleaseAidl
:diffpath:generateReleaseBuildConfig
:diffpath:mergeReleaseShaders
:diffpath:compileReleaseShaders
:diffpath:generateReleaseAssets
:diffpath:mergeReleaseAssets
:diffpath:processReleaseManifest
:diffpath:processReleaseResources
:diffpath:generateReleaseSources
:diffpath:incrementalReleaseJavaCompilationSafeguard
:diffpath:compileReleaseJavaWithJavac
:diffpath:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
:diffpath:processReleaseJavaRes UP-TO-DATE
:diffpath:transformResourcesWithMergeJavaResForRelease
:diffpath:transformClassesAndResourcesWithSyncLibJarsForRelease
:diffpath:mergeReleaseJniLibFolders
:diffpath:transformNative_libsWithMergeJniLibsForRelease
:diffpath:transformNative_libsWithSyncJniLibsForRelease
:diffpath:bundleRelease
:bsdiffpatch:prepareAndroidDiffpatchDiffpathUnspecifiedLibrary
:bsdiffpatch:prepareComGetkeepsafeRelinkerRelinker121Library
:bsdiffpatch:prepareArm7DebugDependencies
:bsdiffpatch:compileArm7DebugAidl
:bsdiffpatch:compileArm7DebugRenderscript
:bsdiffpatch:generateArm7DebugBuildConfig
:bsdiffpatch:mergeArm7DebugShaders
:bsdiffpatch:compileArm7DebugShaders
:bsdiffpatch:generateArm7DebugAssets
:bsdiffpatch:mergeArm7DebugAssets
:bsdiffpatch:generateArm7DebugResValues UP-TO-DATE
:bsdiffpatch:generateArm7DebugResources
:bsdiffpatch:mergeArm7DebugResources
:bsdiffpatch:processArm7DebugManifest
:bsdiffpatch:processArm7DebugResources
:bsdiffpatch:generateArm7DebugSources
:bsdiffpatch:incrementalArm7DebugJavaCompilationSafeguard
:bsdiffpatch:compileArm7DebugJavaWithJavac
:bsdiffpatch:compileArm7DebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
:bsdiffpatch:extractArm7DebugAnnotations
:bsdiffpatch:mergeArm7DebugProguardFiles UP-TO-DATE
:bsdiffpatch:packageArm7DebugRenderscript UP-TO-DATE
:bsdiffpatch:packageArm7DebugResources
:bsdiffpatch:processArm7DebugJavaRes UP-TO-DATE
:bsdiffpatch:transformResourcesWithMergeJavaResForArm7Debug
:bsdiffpatch:transformClassesAndResourcesWithSyncLibJarsForArm7Debug
:bsdiffpatch:mergeArm7DebugJniLibFolders
:bsdiffpatch:transformNative_libsWithMergeJniLibsForArm7Debug
:bsdiffpatch:transformNative_libsWithSyncJniLibsForArm7Debug
:bsdiffpatch:bundleArm7Debug
:bsdiffpatch:compileArm7DebugSources
:bsdiffpatch:assembleArm7Debug
:bsdiffpatch:compileBsdiffpatchArmeabi-v7aReleaseSharedLibraryBsdiffpatchMainC
:bsdiffpatch:linkBsdiffpatchArmeabi-v7aReleaseSharedLibrary
:bsdiffpatch:bsdiffpatchArmeabi-v7aReleaseSharedLibrary
:bsdiffpatch:stripSymbolsArmeabi-v7aReleaseSharedLibrary
:bsdiffpatch:ndkBuildArmeabi-v7aReleaseSharedLibrary
:bsdiffpatch:ndkBuildArmeabi-v7aReleaseStaticLibrary UP-TO-DATE
:bsdiffpatch:androidArm7Release
:bsdiffpatch:copyArm7ReleaseLint UP-TO-DATE
:bsdiffpatch:checkArm7ReleaseManifest
:bsdiffpatch:prepareArm7ReleaseDependencies
:bsdiffpatch:compileArm7ReleaseAidl
:bsdiffpatch:compileArm7ReleaseRenderscript
:bsdiffpatch:generateArm7ReleaseBuildConfig
:bsdiffpatch:mergeArm7ReleaseShaders
:bsdiffpatch:compileArm7ReleaseShaders
:bsdiffpatch:generateArm7ReleaseAssets
:bsdiffpatch:mergeArm7ReleaseAssets
:bsdiffpatch:generateArm7ReleaseResValues UP-TO-DATE
:bsdiffpatch:generateArm7ReleaseResources
:bsdiffpatch:mergeArm7ReleaseResources
:bsdiffpatch:processArm7ReleaseManifest
:bsdiffpatch:processArm7ReleaseResources
:bsdiffpatch:generateArm7ReleaseSources
:bsdiffpatch:incrementalArm7ReleaseJavaCompilationSafeguard
:bsdiffpatch:compileArm7ReleaseJavaWithJavac
:bsdiffpatch:compileArm7ReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
:bsdiffpatch:extractArm7ReleaseAnnotations
:bsdiffpatch:mergeArm7ReleaseProguardFiles UP-TO-DATE
:bsdiffpatch:packageArm7ReleaseRenderscript UP-TO-DATE
:bsdiffpatch:packageArm7ReleaseResources
:bsdiffpatch:processArm7ReleaseJavaRes UP-TO-DATE
:bsdiffpatch:transformResourcesWithMergeJavaResForArm7Release
:bsdiffpatch:transformClassesAndResourcesWithSyncLibJarsForArm7Release
:bsdiffpatch:mergeArm7ReleaseJniLibFolders
:bsdiffpatch:transformNative_libsWithMergeJniLibsForArm7Release
:bsdiffpatch:transformNative_libsWithSyncJniLibsForArm7Release
:bsdiffpatch:bundleArm7Release
:bsdiffpatch:compileArm7ReleaseSources
:bsdiffpatch:assembleArm7Release
:bsdiffpatch:assembleArm7
:hdiffpatch:compileHdiffpatchArmeabi-v7aDebugSharedLibraryHdiffpatchMainC
:hdiffpatch:compileHdiffpatchArmeabi-v7aDebugSharedLibraryHdiffpatchMainCpp/home/snowdream/snowdream/git/android-diffpatch/hdiffpatch/src/main/jni/HDiff/private_diff/suffix_string.cpp: In function 'void {anonymous}::_suffixString_create(const char*, const char*, std::vector<TSAInt>&)':
/home/snowdream/snowdream/git/android-diffpatch/hdiffpatch/src/main/jni/HDiff/private_diff/suffix_string.cpp:93:19: error: 'runtime_error' is not a member of 'std'
             throw std::runtime_error("suffixString_create() error.");
                   ^
In file included from /home/snowdream/snowdream/git/android-diffpatch/hdiffpatch/src/main/jni/HDiff/private_diff/suffix_string.cpp:34:0:
/home/snowdream/snowdream/git/android-diffpatch/hdiffpatch/src/main/jni/HDiff/private_diff/sais.hxx: In instantiation of 'index_type saisxx_private::suffixsort(string_type, sarray_type, index_type, index_type, index_type, bool) [with string_type = const unsigned char*; sarray_type = int*; index_type = int]':
/home/snowdream/snowdream/git/android-diffpatch/hdiffpatch/src/main/jni/HDiff/private_diff/sais.hxx:560:70:   required from 'index_type saisxx(string_type, sarray_type, index_type, index_type) [with string_type = const unsigned char*; sarray_type = int*; index_type = int]'
/home/snowdream/snowdream/git/android-diffpatch/hdiffpatch/src/main/jni/HDiff/private_diff/suffix_string.cpp:92:67:   required from 'void {anonymous}::_suffixString_create(const char*, const char*, std::vector<TSAInt>&) [with TSAInt = int]'
/home/snowdream/snowdream/git/android-diffpatch/hdiffpatch/src/main/jni/HDiff/private_diff/suffix_string.cpp:125:62:   required from here
/home/snowdream/snowdream/git/android-diffpatch/hdiffpatch/src/main/jni/HDiff/private_diff/sais.hxx:438:37: error: exception handling disabled, use -fexceptions to enable
     try { Cp = new index_type[k]; } catch(...) { Cp = 0; }
                                     ^

/home/snowdream/snowdream/git/android-diffpatch/hdiffpatch/src/main/jni/native_patch.cpp: In function 'hpatch_StreamPos_t getFilePos64(FILE*)':
/home/snowdream/snowdream/git/android-diffpatch/hdiffpatch/src/main/jni/native_patch.cpp:53:16: error: request for member '__pos' in 'pos', which is of non-class type 'fpos_t {aka long int}'
     return pos.__pos;
                ^
/home/snowdream/snowdream/git/android-diffpatch/hdiffpatch/src/main/jni/native_patch.cpp: In function 'void setFilePos64(FILE*, hpatch_StreamPos_t)':
/home/snowdream/snowdream/git/android-diffpatch/hdiffpatch/src/main/jni/native_patch.cpp:63:9: error: request for member '__pos' in 'pos', which is of non-class type 'fpos_t {aka long int}'
     pos.__pos=seekPos; //safe?
         ^
/home/snowdream/snowdream/git/android-diffpatch/hdiffpatch/src/main/jni/native_patch.cpp: In function 'jint hpatch(JNIEnv*, jobject, jstring, jstring, jstring)':
/home/snowdream/snowdream/git/android-diffpatch/hdiffpatch/src/main/jni/native_patch.cpp:297:13: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
     argv[0] = "hpatch";
             ^

 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':hdiffpatch:compileHdiffpatchArmeabi-v7aDebugSharedLibraryHdiffpatchMainCpp'.
> Multiple build operations failed.
      C++ compiler failed while compiling suffix_string.cpp.
      C++ compiler failed while compiling native_patch.cpp.
  See the complete log at: file:///home/snowdream/snowdream/git/android-diffpatch/hdiffpatch/build/tmp/compileHdiffpatchArmeabi-v7aDebugSharedLibraryHdiffpatchMainCpp/output.txt

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 1 mins 10.923 secs
20:21:47: External task execution finished 'assembleArm7'.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.