assets bundle

This commit is contained in:
pengfei.zhou 2019-08-09 15:44:07 +08:00
parent f1efee6a3e
commit 73b9d97e6d
6 changed files with 5 additions and 13 deletions

View File

@ -16,11 +16,6 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
} }
} }
sourceSets {
main {
assets.srcDirs = [project.rootDir.getParent() + "/js-framework/demo"]
}
}
} }
dependencies { dependencies {

View File

@ -0,0 +1 @@
../../../../../js-framework/demo

View File

@ -19,7 +19,7 @@ public class MainActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);
DoricContext doricContext = DoricContext.create(this, DoricUtils.readAssetFile("demo.js"), "demo"); DoricContext doricContext = DoricContext.create(this, DoricUtils.readAssetFile("demo/demo.js"), "demo");
doricContext.callEntity("__init__", new JSONBuilder() doricContext.callEntity("__init__", new JSONBuilder()
.put("width", ViewGroup.LayoutParams.MATCH_PARENT) .put("width", ViewGroup.LayoutParams.MATCH_PARENT)
.put("height", ViewGroup.LayoutParams.MATCH_PARENT)); .put("height", ViewGroup.LayoutParams.MATCH_PARENT));

View File

@ -21,11 +21,6 @@ android {
consumerProguardFiles 'proguard-rules.pro' consumerProguardFiles 'proguard-rules.pro'
} }
} }
sourceSets {
main {
assets.srcDirs = [project.rootDir.getParent() + "/js-framework/bundle"]
}
}
} }
afterEvaluate { afterEvaluate {

View File

@ -0,0 +1 @@
../../../../../js-framework/bundle

View File

@ -6,8 +6,8 @@ package com.github.penfeizhou.doric.utils;
* @CreateDate: 2019-07-18 * @CreateDate: 2019-07-18
*/ */
public class DoricConstant { public class DoricConstant {
public static final String DORIC_BUNDLE_SANDBOX = "doric-sandbox.js"; public static final String DORIC_BUNDLE_SANDBOX = "bundle/doric-sandbox.js";
public static final String DORIC_BUNDLE_LIB = "doric-lib.js"; public static final String DORIC_BUNDLE_LIB = "bundle/doric-lib.js";
public static final String DORIC_MODULE_LIB = "./index"; public static final String DORIC_MODULE_LIB = "./index";