diff --git a/android/sdk/.gitignore b/android/sdk/.gitignore index 4e5bda935b..cb8cf1eed8 100755 --- a/android/sdk/.gitignore +++ b/android/sdk/.gitignore @@ -16,3 +16,10 @@ assets/main.js assets/weex-main-jsfm.js assets/weex-rax-api.js .externalNativeBuild + +/libs/armeabi/libweexcore.so +/libs/armeabi/libweexjss.so +/libs/armeabi-v7a/libweexcore.so +/libs/armeabi-v7a/libweexjss.so +/libs/x86/libweexcore.so +/libs/x86/libweexjss.so diff --git a/android/sdk/build.gradle b/android/sdk/build.gradle index f7cca209f7..04b24c7616 100755 --- a/android/sdk/build.gradle +++ b/android/sdk/build.gradle @@ -116,9 +116,6 @@ android { } } - def ARMEABI_Size = new File(projectDir,"libs/armeabi/libweexcore.so").length(); - def ARMEABIV7_Size = new File(projectDir,"libs/armeabi-v7/libweexcore.so").length(); - def X86_Size = new File(projectDir,"libs/x86/libweexcore.so").length(); def ndkversion = 16; def api_level = ""; def compile_tool = "clang"; @@ -128,14 +125,8 @@ android { } else { api_level = "android-19"; } - println "ARMEABI_Size: "+ARMEABI_Size; - println "ARMEABIV7_Size:" + ARMEABIV7_Size; - println "X86_Size:" + X86_Size; defaultConfig { - buildConfigField "long", "ARMEABI_Size", "${ARMEABI_Size}" - buildConfigField "long", "ARMEABIV7_Size", "${ARMEABIV7_Size}" - buildConfigField "long", "X86_Size", "${X86_Size}" buildConfigField "String", "buildJavascriptFrameworkVersion", "\"${jsfmVersion}\"" buildConfigField "String", "buildVersion", "\"${version}\"" minSdkVersion project.minSdkVersion @@ -152,15 +143,13 @@ android { abiFilters "armeabi-v7a", "armeabi", "x86" } } - if(project.buildCpp) { - externalNativeBuild { - cmake { - arguments '-DANDROID_PLATFORM=' + "${api_level}", - '-DANDROID_TOOLCHAIN=' + "${compile_tool}", - '-DANDROID_STL=' + "${cxx_stl}", - '-DCMAKE_BUILD_TYPE=Release', - '-DENABLE_ASAN=false' - } + externalNativeBuild { + cmake { + arguments '-DANDROID_PLATFORM=' + "${api_level}", + '-DANDROID_TOOLCHAIN=' + "${compile_tool}", + '-DANDROID_STL=' + "${cxx_stl}", + '-DCMAKE_BUILD_TYPE=Release', + '-DENABLE_ASAN=false' } } } @@ -181,11 +170,9 @@ android { } } - if(project.buildCpp) { - externalNativeBuild { - cmake { - path '../../weex_core/CMakeLists.txt' - } + externalNativeBuild { + cmake { + path '../../weex_core/CMakeLists.txt' } } @@ -371,54 +358,4 @@ bintray { name = project.version } } -} - -def copy_so_and_backup() { - def cpu_list = ["armeabi", "armeabi-v7a", "x86"] - cpu_list.forEach { cpu_name -> - File so_file = new File(project.buildDir, "/intermediates/bundles/default/jni/" + cpu_name) - if (so_file.exists()) { - println(so_file.getAbsolutePath()) - copy { - from so_file.getAbsolutePath() - into new File("libs/" + cpu_name) - include 'libweexjss.so', 'libweexcore.so' - } - - if(cpu_name == "armeabi") { - File back_file = new File(project.buildDir, "/intermediates/cmake/release/obj/armeabi/") - //backup so to project'parent's path - File backup_des = new File(project.buildDir.parentFile.parentFile.parentFile.parentFile,"weex_so_armeabi") - if(backup_des.exists()){ - backup_des.deleteDir() - backup_des.mkdir() - } - println(backup_des.absolutePath) - - println("so backup to "+ backup_des.absolutePath) - copy { - from back_file.getAbsolutePath() - into backup_des - include 'libweexjss.so', 'libweexcore.so' - } - } - } - } -} - -task deleteLibs(type: Delete){ item-> - project.android.defaultConfig.ndk.abiFilters.each{ - item.delete "libs/${it}/libweexcore.so", "libs/${it}/libweexjss.so" - } -} - -afterEvaluate { project -> - project.tasks.find { (it.name.contains("assembleRelease")) }?.doLast { - println("begin_copy_so") - copy_so_and_backup() - } - - if(project.buildCpp){ - transformNativeLibsWithStripDebugSymbolForRelease.dependsOn deleteLibs - } } \ No newline at end of file diff --git a/android/sdk/libs/armeabi-v7a/libweexcore.so b/android/sdk/libs/armeabi-v7a/libweexcore.so deleted file mode 100644 index 20422d8d92..0000000000 Binary files a/android/sdk/libs/armeabi-v7a/libweexcore.so and /dev/null differ diff --git a/android/sdk/libs/armeabi-v7a/libweexjss.so b/android/sdk/libs/armeabi-v7a/libweexjss.so deleted file mode 100644 index 7291bae484..0000000000 Binary files a/android/sdk/libs/armeabi-v7a/libweexjss.so and /dev/null differ diff --git a/android/sdk/libs/armeabi/libweexcore.so b/android/sdk/libs/armeabi/libweexcore.so deleted file mode 100644 index 32d0f9fbb2..0000000000 Binary files a/android/sdk/libs/armeabi/libweexcore.so and /dev/null differ diff --git a/android/sdk/libs/armeabi/libweexjss.so b/android/sdk/libs/armeabi/libweexjss.so deleted file mode 100644 index 162b3e603d..0000000000 Binary files a/android/sdk/libs/armeabi/libweexjss.so and /dev/null differ diff --git a/android/sdk/libs/x86/libweexcore.so b/android/sdk/libs/x86/libweexcore.so deleted file mode 100644 index e2e0dd7a43..0000000000 Binary files a/android/sdk/libs/x86/libweexcore.so and /dev/null differ diff --git a/android/sdk/libs/x86/libweexjss.so b/android/sdk/libs/x86/libweexjss.so deleted file mode 100644 index bb1a94a7b8..0000000000 Binary files a/android/sdk/libs/x86/libweexjss.so and /dev/null differ diff --git a/android/sdk/src/main/java/com/taobao/weex/utils/WXSoInstallMgrSdk.java b/android/sdk/src/main/java/com/taobao/weex/utils/WXSoInstallMgrSdk.java index 21da7804ca..a43be0e36a 100644 --- a/android/sdk/src/main/java/com/taobao/weex/utils/WXSoInstallMgrSdk.java +++ b/android/sdk/src/main/java/com/taobao/weex/utils/WXSoInstallMgrSdk.java @@ -21,16 +21,13 @@ import android.content.Context; import android.content.pm.ApplicationInfo; import android.os.Build; -import android.system.ErrnoException; -import android.system.Os; import android.text.TextUtils; - import com.taobao.weex.IWXStatisticsListener; import com.taobao.weex.WXEnvironment; import com.taobao.weex.adapter.IWXSoLoaderAdapter; import com.taobao.weex.adapter.IWXUserTrackAdapter; import com.taobao.weex.common.WXErrorCode; - +import dalvik.system.PathClassLoader; import java.io.BufferedReader; import java.io.Closeable; import java.io.File; @@ -48,8 +45,6 @@ import java.util.zip.ZipException; import java.util.zip.ZipFile; -import dalvik.system.PathClassLoader; - /** * Utility class for managing so library, including load native library and version management. @@ -76,8 +71,6 @@ public class WXSoInstallMgrSdk { private final static String STARTUPSO = "/libweexjsb.so"; private final static String STARTUPSOANDROID15 = "/libweexjst.so"; - private final static int ARMEABI_Size = 3583820; - private final static int X86_Size = 4340864; static Context mContext = null; private static IWXSoLoaderAdapter mSoLoader = null;