wequick / small Goto Github PK
View Code? Open in Web Editor NEWA small framework to split app into small parts
Home Page: http://code.wequick.net/Small
License: Apache License 2.0
A small framework to split app into small parts
Home Page: http://code.wequick.net/Small
License: Apache License 2.0
Caused by: java.lang.NullPointerException: Cannot invoke method rightShift() on null object
at net.wequick.gradle.aapt.CppHexEditor.writeInt(CppHexEditor.groovy:100)
at net.wequick.gradle.aapt.ArscEditor$_writeTypeList_closure6$_closure15.doCall(ArscEditor.groovy:474)
at net.wequick.gradle.aapt.ArscEditor$_writeTypeList_closure6.doCall(ArscEditor.groovy:473)
at net.wequick.gradle.aapt.ArscEditor.writeTypeList(ArscEditor.groovy:466)
at net.wequick.gradle.aapt.ArscEditor$writeTypeList$5.callCurrent(Unknown Source)
at net.wequick.gradle.aapt.ArscEditor.writeTable(ArscEditor.groovy:349)
at net.wequick.gradle.aapt.ArscEditor$writeTable$3.callCurrent(Unknown Source)
at net.wequick.gradle.aapt.ArscEditor.slice(ArscEditor.groovy:230)
at net.wequick.gradle.aapt.ArscEditor$slice.call(Unknown Source)
at net.wequick.gradle.aapt.Aapt.filterPackage(Aapt.groovy:59)
at net.wequick.gradle.aapt.Aapt$filterPackage$0.call(Unknown Source)
at net.wequick.gradle.AppPlugin$_hookVariantTask_closure15.doCall(AppPlugin.groovy:331)
at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:558)
at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:539)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter
.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecute
r.java:61)
... 49 more
In DevSample
project, while building with command:
gradlew :app.*:assembleRelease
It raise an error:
**\app\test\MainActivity.java:12: 错误: 程序包net.wequick.small不存在
import net.wequick.small.Small;
^
While specify rules
in bundle.json
, Small failed to resolve the exact activity to launch but start a Web page.
code:
Intent intent = new Intent(Intent.ACTION_PICK,android.provider.ContactsContract.Contacts.CONTENT_URI);
startActivityForResult(intent, 1);
Log:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.mysmall/net.wequick.small.A}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2190)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2250)
at android.app.ActivityThread.access$800(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1200)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5049)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:818)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at net.wequick.small.ApkBundleLauncher$InstrumentationWrapper.wrapIntent(ApkBundleLauncher.java:178)
at net.wequick.small.ApkBundleLauncher$InstrumentationWrapper.execStartActivity(ApkBundleLauncher.java:98)
at android.app.Activity.startActivityForResult(Activity.java:3479)
at android.app.Activity.startActivityForResult(Activity.java:3440)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:784)
at com.example.mysmall.app.main.MainActivity.onCreate(MainActivity.java:18)
at android.app.Activity.performCreate(Activity.java:5293)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at net.wequick.small.ApkBundleLauncher$InstrumentationWrapper.callActivityOnCreate(ApkBundleLauncher.java:148)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2154)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2250)?
at android.app.ActivityThread.access$800(ActivityThread.java:139)?
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1200)?
at android.os.Handler.dispatchMessage(Handler.java:102)?
at android.os.Looper.loop(Looper.java:136)?
at android.app.ActivityThread.main(ActivityThread.java:5049)?
at java.lang.reflect.Method.invokeNative(Native Method)?
at java.lang.reflect.Method.invoke(Method.java:515)?
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:818)?
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634)?
at dalvik.system.NativeStart.main(Native Method)?
不支持Lib使用第三方项目带有attr属性的文件,使用第三方的项目是https://github.com/afollestad/material-dialogs
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':lib.test:processReleaseResources'.
Missing library resource entry: "attr/md_background_color", try to cleanLib and buildLib.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
场景:应用依赖三方开源控件,控件有自定义属性,并且自定义属性形如这类android自带的属性时会buildLib失败,提示:
Missing library resource entry: "styleable/StickyListHeadersListView_android_cacheColorHint", try to cleanLib and buildLib.
roidRuntime(11134): Process: net.wequick.example.small, PID: 11134
E/AndroidRuntime(11134): java.lang.RuntimeException: Unable to start activity ComponentInfo{net.wequick.example.small/net.wequick.small.A}: android.view.InflateException: Binary XML file line #18: Error inflating class
E/AndroidRuntime(11134): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2197)
E/AndroidRuntime(11134): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2257)
E/AndroidRuntime(11134): at android.app.ActivityThread.access$800(ActivityThread.java:143)
E/AndroidRuntime(11134): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1209)
E/AndroidRuntime(11134): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(11134): at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime(11134): at android.app.ActivityThread.main(ActivityThread.java:5120)
E/AndroidRuntime(11134): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(11134): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime(11134): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:818)
E/AndroidRuntime(11134): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634)
E/AndroidRuntime(11134): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(11134): Caused by: android.view.InflateException: Binary XML file line #18: Error inflating class
E/AndroidRuntime(11134): at android.view.LayoutInflater.createView(LayoutInflater.java:620)
E/AndroidRuntime(11134): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
E/AndroidRuntime(11134): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
E/AndroidRuntime(11134): at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
E/AndroidRuntime(11134): at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
E/AndroidRuntime(11134): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
E/AndroidRuntime(11134): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
E/AndroidRuntime(11134): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
E/AndroidRuntime(11134): at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:256)
E/AndroidRuntime(11134): at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
E/AndroidRuntime(11134): at net.wequick.example.small.app.main.MainActivity.onCreate(MainActivity.java:53)
E/AndroidRuntime(11134): at android.app.Activity.performCreate(Activity.java:5351)
E/AndroidRuntime(11134): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
E/AndroidRuntime(11134): at net.wequick.small.ApkBundleLauncher$InstrumentationWrapper.callActivityOnCreate(ApkBundleLauncher.java:148)
E/AndroidRuntime(11134): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2161)
E/AndroidRuntime(11134): ... 11 more
E/AndroidRuntime(11134): Caused by: java.lang.reflect.InvocationTargetException
E/AndroidRuntime(11134): at java.lang.reflect.Constructor.constructNative(Native Method)
E/AndroidRuntime(11134): at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
E/AndroidRuntime(11134): at android.view.LayoutInflater.createView(LayoutInflater.java:594)
E/AndroidRuntime(11134): ... 25 more
E/AndroidRuntime(11134): Caused by: java.lang.ArrayIndexOutOfBoundsException: length=9; index=9
E/AndroidRuntime(11134): at android.content.res.AssetManager.getPooledString(AssetManager.java:291)
E/AndroidRuntime(11134): at android.content.res.TypedArray.loadStringValueAt(TypedArray.java:727)
E/AndroidRuntime(11134): at android.content.res.TypedArray.getValueAt(TypedArray.java:712)
E/AndroidRuntime(11134): at android.content.res.TypedArray.getColorStateList(TypedArray.java:342)
E/AndroidRuntime(11134): at android.support.v7.widget.ThemeUtils.getThemeAttrColorStateList(ThemeUtils.java:76)
E/AndroidRuntime(11134): at android.support.v7.widget.TintManager.getTintList(TintManager.java:314)
E/AndroidRuntime(11134): at android.support.v7.widget.TintManager.getDrawable(TintManager.java:183)
E/AndroidRuntime(11134): at android.support.v7.widget.TintManager.getDrawable(TintManager.java:168)
E/AndroidRuntime(11134): at android.support.v7.widget.TintTypedArray.getDrawable(TintTypedArray.java:62)
E/AndroidRuntime(11134): at android.support.v7.widget.Toolbar.(Toolbar.java:257)
E/AndroidRuntime(11134): at android.support.v7.widget.Toolbar.(Toolbar.java:199)
E/AndroidRuntime(11134): ... 28 more
E/OppoPhoneWindow( 897): OppoPhoneWindow
插件中在JAVA代码中使用公共Lib中颜色值时,com,xx,xx,lib.xx.R.color.xx 获取到lib中的颜色值被改为 7F - 0B002E ,而不是原有的插件的资源分区的前缀如73 - xxxxxx,导致颜色取值失败。
在app项目架构页面我下滑,点击loading演示进去再返回的时候,变成了项目架构第一屏,是不是直接显示第二屏更好些
插件的string/app_name、mipmap/ic_launcher在resources.arsc中被分离以减少插件包大小。
但是插件manifest的<application>
标签仍包含对二者的引用,其资源ID在编译阶段被替换成了宿主的。
在对插件合并资源前,二者被访问了(何时尚未知),导致警告:
W/ResourceType: No known package when getting value for resource number 0x7f060014
W/ResourceType: No known package when getting value for resource number 0x7f030000
解决方法:过滤插件AndroidManifest.xml
中的非保留资源。实现后插件将会更小,并再无缩减空间。
解决思路:修改AndroidManifest.xml
二进制文件
要修改的代码(请先更新代码,以下内容已预置):
buildSrc/src/main/groovy/net/wequick/gradle/aapt/AxmlEditor.groovy
def slice(int pp, Map idMaps, List retainedTypes) {
// TODO: slice resources exclude `retainedTypes'
println retainedTypes
}
buildSrc/src/main/groovy/net/wequick/gradle/aapt/Aapt.groovy
void filterPackage(List retainedTypes, int pp, Map idMaps) {
File arscFile = new File(mAssetDir, 'resources.arsc')
if (retainedTypes.size() == 0) {
// Remove everything
mJavaFile.write('')
if (mSymbolFile != null) mSymbolFile.write('')
arscFile.delete()
return
}
def arscEditor = new ArscEditor(arscFile)
// Filter R.java
filterRjava(mJavaFile, retainedTypes, null)
// Filter R.txt
if (mSymbolFile != null) filterRtext(mSymbolFile, retainedTypes)
// Filter resources.arsc
arscEditor.slice(pp, idMaps, retainedTypes)
// Filter AndroidManifest.xml
File manifest = new File(mAssetDir, 'AndroidManifest.xml')
AXmlEditor xmlEditor = new AXmlEditor(manifest)
xmlEditor.slice(pp, idMaps, retainedTypes)
// Reset xml package id
File resDir = new File(mAssetDir, 'res')
resetAllXmlPackageId(resDir, pp, idMaps)
}
宿主module不包含寄生module的资源文件,buildBundle时报如下错误
Missing library resource entry: "array/de_search_letters", try to cleanLib and buildLib.
SoBundleLauncher类里getPluginInfo返回值一直为空.
protected PackageInfo getPluginInfo(File plugin) {
if (plugin == null || !plugin.exists()) return null;
PackageManager pm = Small.getContext().getPackageManager();
File file = new File(plugin.getPath());
if (file.exists()) {
System.out.println("============有这个文件");
} else {
System.out.println("============没有这个文件");
}
PackageInfo pluginInfo = pm.getPackageArchiveInfo(plugin.getPath(),
PackageManager.GET_SIGNATURES);
return pluginInfo;
}
我写了一个测试,发现能找到这个文件,但是pluginInfo一直为null
// app 调起 app.main
Small.openUri("main", LaunchActivity.this);
相互依赖,一方直接使用另外一方
适用于app. 对 lib. 的调用,或者 lib. 之间的调用
app.home 依赖了 net.wequick.example.small.lib.utils
// User libraries
compile project(':lib.style')
compile project(':lib.utils')
// app.home 中直接使用
import net.wequick.example.small.lib.utils.UIUtils;
...
UIUtils.showToast(getContext(), "Hello World!");
感谢作者,很赞的工作!看了一下介绍和例子,不知道理解的有没有错
有两个问题:
Fragment fragment = Small.createObject("fragment-v4", sUris[position], MainActivity.this);
01-08 15:48:39.430 20653-20705/net.wequick.example.small W/ResourceType: Failure getting entry for 0x06060014 (t=5 e=20) (error -2147483647)
01-08 15:48:39.438 20653-20705/net.wequick.example.small W/ResourceType: Failure getting entry for 0x06060014 (t=5 e=20) (error -2147483647)
01-08 15:48:39.470 20653-20705/net.wequick.example.small W/art: The dalvik.system.DexPathList$Element constructor is not accessible by default. This is a temporary workaround for backwards compatibility with class-loader hacks. Please update your application.
01-08 15:48:39.473 20653-20705/net.wequick.example.small W/ResourceType: No known package when getting value for resource number 0x7f060014
01-08 15:48:39.473 20653-20705/net.wequick.example.small W/ResourceType: No known package when getting value for resource number 0x7f060014
01-08 15:48:39.477 20653-20705/net.wequick.example.small W/ResourceType: No known package when getting value for resource number 0x7f060014
01-08 15:48:39.477 20653-20705/net.wequick.example.small W/ResourceType: No known package when getting value for resource number 0x7f060014
01-08 15:48:39.491 20653-20705/net.wequick.example.small I/art: override thread count:-j4
01-08 15:48:39.541 20653-20710/net.wequick.example.small I/Adreno: QUALCOMM build : 501976e, I3f0caecb49
Build Date : 10/08/15
OpenGL ES Shader Compiler Version: XE031.05.13.03
Local Branch :
Remote Branch : refs/tags/AU_LINUX_ANDROID_PRIVATE_REDFOX64_MBR_RB1.05.01.01.003.022
Remote Branch : NONE
Reconstruct Branch : NOTHING
01-08 15:48:39.578 20653-20705/net.wequick.example.small W/art: The dalvik.system.DexPathList$Element constructor is not accessible by default. This is a temporary workaround for backwards compatibility with class-loader hacks. Please update your application.
01-08 15:48:39.580 20653-20705/net.wequick.example.small W/ResourceType: For resource 0x46060014, entry index(20) is beyond type entryCount(3)
01-08 15:48:39.580 20653-20705/net.wequick.example.small W/ResourceType: Failure getting entry for 0x46060014 (t=5 e=20) (error -75)
01-08 15:48:39.584 20653-20705/net.wequick.example.small W/ResourceType: For resource 0x46060014, entry index(20) is beyond type entryCount(3)
01-08 15:48:39.584 20653-20705/net.wequick.example.small W/ResourceType: Failure getting entry for 0x46060014 (t=5 e=20) (error -75)
01-08 15:48:39.600 20653-20705/net.wequick.example.small I/art: override thread count:-j4
01-08 15:48:39.688 20653-20705/net.wequick.example.small W/art: The dalvik.system.DexPathList$Element constructor is not accessible by default. This is a temporary workaround for backwards compatibility with class-loader hacks. Please update your application.
01-08 15:48:39.690 20653-20705/net.wequick.example.small W/ResourceType: No known package when getting value for resource number 0x7f060014
01-08 15:48:39.690 20653-20705/net.wequick.example.small W/ResourceType: No known package when getting value for resource number 0x7f030000
01-08 15:48:39.694 20653-20705/net.wequick.example.small W/ResourceType: No known package when getting value for resource number 0x7f060014
01-08 15:48:39.694 20653-20705/net.wequick.example.small W/ResourceType: No known package when getting value for resource number 0x7f030000
01-08 15:48:39.707 20653-20705/net.wequick.example.small I/art: override thread count:-j4
01-08 15:48:39.790 20653-20705/net.wequick.example.small W/art: The dalvik.system.DexPathList$Element constructor is not accessible by default. This is a temporary workaround for backwards compatibility with class-loader hacks. Please update your application.
01-08 15:48:39.793 20653-20705/net.wequick.example.small W/ResourceType: Failure getting entry for 0x5e060014 (t=5 e=20) (error -2147483647)
01-08 15:48:39.797 20653-20705/net.wequick.example.small W/ResourceType: Failure getting entry for 0x5e060014 (t=5 e=20) (error -2147483647)
01-08 15:48:39.815 20653-20705/net.wequick.example.small I/art: override thread count:-j4
01-08 15:48:39.906 20653-20705/net.wequick.example.small W/art: The dalvik.system.DexPathList$Element constructor is not accessible by default. This is a temporary workaround for backwards compatibility with class-loader hacks. Please update your application.
01-08 15:48:39.910 20653-20705/net.wequick.example.small I/PackageParser: net.wequick.example.small.web.about: compat added android.permission.WRITE_EXTERNAL_STORAGE android.permission.READ_PHONE_STATE
01-08 15:48:39.960 20653-20653/net.wequick.example.small I/WebViewFactory: Loading com.google.android.webview version 45.0.2454.95 (code 246109550)
01-08 15:48:40.100 20653-20653/net.wequick.example.small W/System: ClassLoader referenced unknown path: /system/app/WebViewGoogle/lib/arm
01-08 15:48:40.128 20653-20653/net.wequick.example.small I/cr.library_loader: Time to load native libraries: 15 ms (timestamps 2279-2294)
01-08 15:48:40.128 20653-20653/net.wequick.example.small I/cr.library_loader: Expected native library version number "", actual native library version number ""
01-08 15:48:40.169 20653-20653/net.wequick.example.small V/WebViewChromiumFactoryProvider: Binding Chromium to main looper Looper (main, tid 1) {6afd7f0}
01-08 15:48:40.170 20653-20653/net.wequick.example.small I/cr.library_loader: Expected native library version number "", actual native library version number ""
01-08 15:48:40.170 20653-20653/net.wequick.example.small I/chromium: [INFO:library_loader_hooks.cc(121)] Chromium logging enabled: level = 0, default verbosity = 0
01-08 15:48:40.180 20653-20653/net.wequick.example.small I/cr.BrowserStartup: Initializing chromium process, singleProcess=true
01-08 15:48:40.181 20653-20653/net.wequick.example.small W/art: Attempt to remove non-JNI local reference, dumping thread
01-08 15:48:40.191 20653-20653/net.wequick.example.small E/SysUtils: ApplicationContext is null in ApplicationStatus
01-08 15:48:40.326 20653-20796/net.wequick.example.small W/cr.media: Requires BLUETOOTH permission
01-08 15:48:40.418 20653-20653/net.wequick.example.small E/libEGL: validate_display:255 error 3008 (EGL_BAD_DISPLAY)
01-08 15:48:40.422 20653-20805/net.wequick.example.small E/ActivityThread: Failed to find provider info for com.google.settings
01-08 15:48:40.475 20653-20653/net.wequick.example.small W/art: Attempt to remove non-JNI local reference, dumping thread
01-08 15:48:40.484 20653-20653/net.wequick.example.small W/AwContents: onDetachedFromWindow called when already detached. Ignoring
01-08 15:48:40.487 20653-20653/net.wequick.example.small W/art: Attempt to remove non-JNI local reference, dumping thread
01-08 15:48:40.487 20653-20653/net.wequick.example.small W/art: Attempt to remove non-JNI local reference, dumping thread
01-08 15:48:40.488 20653-20653/net.wequick.example.small D/Web: loadUrl: file:/data/user/0/net.wequick.example.small/app_sm-web/net.wequick.example.small.web.about/index.html
01-08 15:48:40.531 20653-20794/net.wequick.example.small W/chromium: [WARNING:data_reduction_proxy_config.cc(630)] SPDY proxy OFF at startup
01-08 15:48:40.639 20653-20653/net.wequick.example.small W/cr.BindingManager: Cannot call determinedVisibility() - never saw a connection for the pid: 20653
01-08 15:48:40.719 20653-20653/net.wequick.example.small W/cr.BindingManager: Cannot call determinedVisibility() - never saw a connection for the pid: 20653
01-08 15:48:42.606 20653-20710/net.wequick.example.small W/OpenGLRenderer: Fail to change FontRenderer cache size, it already initialized
01-08 15:48:42.635 20653-20653/net.wequick.example.small W/ResourceType: ResTable_typeSpec entry count inconsistent: given 2, previously 15
01-08 15:48:42.635 20653-20653/net.wequick.example.small W/ResourceType: ResTable_typeSpec entry count inconsistent: given 4, previously 10
01-08 15:48:42.635 20653-20653/net.wequick.example.small W/ResourceType: ResTable_typeSpec entry count inconsistent: given 3, previously 53
01-08 15:48:42.635 20653-20653/net.wequick.example.small W/ResourceType: ResTable_typeSpec entry count inconsistent: given 1, previously 56
01-08 15:48:42.635 20653-20653/net.wequick.example.small W/ResourceType: ResTable_typeSpec entry count inconsistent: given 1, previously 7
01-08 15:48:42.656 20653-20653/net.wequick.example.small W/ResourceType: Bad XML block: header size 18254 or total size 169478669 is larger than data size 313
--------- beginning of crash
01-08 15:48:42.662 20653-20653/net.wequick.example.small E/AndroidRuntime: FATAL EXCEPTION: main
Process: net.wequick.example.small, PID: 20653
android.content.res.Resources$NotFoundException: File res/drawable-xhdpi-v4/bubble_arrow_up.png from xml type layout resource ID #0x3020001
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2836)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2791)
at android.content.res.Resources.getLayout(Resources.java:1173)
at android.view.LayoutInflater.inflate(LayoutInflater.java:421)
at net.wequick.example.small.app.mine.MainFragment.onCreateView(MainFragment.java:16)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1962)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1248)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1613)
at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:570)
at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:141)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1106)
at android.support.v4.view.ViewPager.populate(ViewPager.java:952)
at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1474)
at android.view.View.measure(View.java:18893)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5966)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1465)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:748)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:630)
at android.view.View.measure(View.java:18893)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5966)
at android.support.design.widget.CoordinatorLayout.onMeasureChild(CoordinatorLayout.java:610)
at android.support.design.widget.CoordinatorLayout.onMeasure(CoordinatorLayout.java:677)
at android.view.View.measure(View.java:18893)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5966)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:135)
at android.view.View.measure(View.java:18893)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5966)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1465)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:748)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:630)
at android.view.View.measure(View.java:18893)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5966)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at android.view.View.measure(View.java:18893)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5966)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1465)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:748)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:630)
at android.view.View.measure(View.java:18893)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5966)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at com.android.internal.policy.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2679)
at android.view.View.measure(View.java:18893)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2192)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1271)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1510)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1162)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6229)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:873)
at android.view.Choreographer.doCallbacks(Choreographer.java:676)
at android.view.Choreographer.doFrame(Choreographer.java:606)
at android.view.Choreographer$Fr
01-08 15:48:43.967 20653-20653/net.wequick.example.small D/Process: killProcess, pid=20653
01-08 15:48:43.975 20653-20653/net.wequick.example.small D/Process: com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException:113 java.lang.ThreadGroup.uncaughtException:693 java.lang.ThreadGroup.uncaughtException:690
如题,看代码没看明白
在 LibraryPlugin.groovy 的 configureProject() 中
def text = project.buildFile.text.replaceAll(
'com\\.android\\.library', 'com.android.application')
下载了sample,跑不起来。插件是怎么被加载的?插件不是先编译成apk然后放到某个路径下,由宿主取加载么?
我下了最新的code,在使用命令gradlew buildLib编译lib库的时候,出现addAssetPath返回类型不匹配的问题,需要将普通数据类型转换成对应的包装类型才能通过(int->Integer),请问这个是怎么回事?
Log 如下:
android.content.res.Resources$NotFoundException: File res/drawable-xxhdpi-v4/common_app_bkg_down_shadow.9.png from xml type layout resource ID #0x3020001
请问,目前不支持注解吗? buildLib 时报错:
TimeUtils.java:9: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
./gradlew buildLib -q
[Small] building library 1 of 3 - app (0x7f)
[Small] building library 2 of 3 - lib.style (0x79)
[lib.style] split library res files... [ OK ]
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':lib.style:processReleaseResources'.
> No support deleting resources on lib.* now
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
以下是我放在lib.style中 style.xml ,并且也在app中拷贝了一份过去
<resources>
<!-- Application theme. -->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<!-- App bar 底色 -->
<item name="colorPrimary">#00000000</item>
<!-- 顶部状态底色 -->
<item name="colorPrimaryDark">#00000000</item>
<item name="actionBarSize">@dimen/navigation_bar_item_height</item>
<!-- 主窗体底色 -->
<item name="android:windowBackground">@color/white</item>
<!-- 自定义toolbar style -->
<item name="toolbarStyle">@style/CToolbar</item>
<item name="android:textColor">#ff333333</item>
<item name="android:textColorHint">@color/common_edit_hint</item>
<item name="attr/actionMenuTextColor">@color/white</item>
<item name="attr/actionMenuTextAppearance">@style/customActionMenuTextAppearance</item>
<item name="android:buttonStyle">@android:style/Widget.Button</item>
<item name="android:buttonStyleSmall">@android:style/Widget.Button.Small</item>
<item name="android:buttonStyleInset">@android:style/Widget.Button.Inset</item>
<item name="android:buttonStyleToggle">@android:style/Widget.Button.Toggle</item>
<item name="popupMenuStyle">@style/PopupMenu.Example</item>
</style>
<style name="AppTheme" parent="AppBaseTheme">
<item name="actionOverflowMenuStyle">@style/OverflowMenu</item>
</style>
<style name="PopupMenu.Example" parent="@style/Widget.AppCompat.PopupMenu">
<item name="android:popupBackground">@drawable/menu_dropdown_panel_example</item>
</style>
<style name="OverflowMenu" parent="Widget.AppCompat.PopupMenu.Overflow">
<!-- Required for pre-Lollipop. -->
<item name="overlapAnchor">false</item>
<item name="android:paddingRight">0dip</item>
<item name="android:dropDownVerticalOffset">0dip</item>
<item name="android:dropDownHorizontalOffset">0dip</item>
</style>
<style name="customActionMenuTextAppearance" parent="TextAppearance.AppCompat.Widget.ActionBar.Menu">
<item name="android:textStyle">normal</item>
<item name="android:textSize">15sp</item>
</style>
<style name="customToolbarTitleTextAppearance" parent="TextAppearance.Widget.AppCompat.Toolbar.Title">
<item name="android:textStyle">normal</item>
<item name="android:textSize">18dp</item>
</style>
<style name="Toolbar_Popup_Dark" parent="Base.ThemeOverlay.AppCompat.Dark">
<item name="android:textColor">#fff</item>
</style>
<style name="Toolbar_Popup" parent="Widget.AppCompat.PopupMenu">
<item name="android:textColor">#fff</item>
</style>
<style name="Toolbar_Popup_Light" parent="Base.ThemeOverlay.AppCompat.Light">
<item name="android:textColor">#000</item>
</style>
<style name="CToolbar" parent="Widget.AppCompat.Toolbar">
<item name="titleTextAppearance">@style/customToolbarTitleTextAppearance</item>
<item name="contentInsetStart">0dp</item>
<item name="popupTheme">@style/Toolbar_Popup_Dark</item>
</style>
</resources>
这是dimens.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="navigation_bar_item_height">45.0dip</dimen>
</resources>
这个是用到的color
<color name="common_edit_hint">#ffc7c7cd</color>
<color name="white">#ffffff</color>
我在宿主的styles加入自定义主题如下:
<style name="MaterialBaseTheme" parent="Theme.AppCompat.Light.NoActionBar"> @color/hexin_bg @color/white @color/status_bar_color @color/app_theme_color @color/app_theme_color @style/AppTheme.Overflow actionBar溢出按钮的样式 @style/ToolbarPopupTheme actionBar溢出菜单的样式 </style>但是系统会报无法找到@sytle/AppTheme.Overflow与@style/ToolbarPopupTheme.
操作如下:在原有Sample 工程的gradle配置添加多渠道相关配置:
添加占位:
manifestPlaceholders = [UMENG_CHANNEL_VALUE: "umeng"]
添加渠道配置:
// 渠道配置
productFlavors {
baidu {}
qihu360 {}
}
productFlavors.all {
flavor -> flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name]
}
添加APK输出:
applicationVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.apk')) {
def fileName = "TestSample${defaultConfig.versionName}_${variant.productFlavors[0].name}.apk"
output.outputFile = new File(outputFile.parent, fileName)
}
}
}
执行 ./gradlew buildLib -q
出现错误:
Task with path 'jarReleaseClasses' not found in project ':app'.
您好,我想把module放到服务器上,动态更新module,这个功能还望早些实现或者提供些思路,谢谢
api16 以下web组件包签名比对失效,需要修改签名方法:
ant.signjar(jar: srcFile, signedjar: destFile, keystore: sc.storeFile.path,
storepass: sc.storePassword, alias: sc.keyAlias, keypass: sc.keyPassword,
digestalg: 'SHA1', sigalg: 'MD5withRSA')
不知道是不是mac版QQ的问题,点QQ群图标加不了群。改成QQ群号码吧。。
文档这一块希望能够出一个从新建项目到集成Small框架的流程说明。
FATAL EXCEPTION: mainb
Process: net.wequick.example.small, PID: 1206
java.lang.RuntimeException: Unable to start activity ComponentInfo{net.wequick.example.small/net.wequick.small.webkit.WebActivity}: java.lang.IllegalArgumentException: Cannot add a null child view to a ViewGroup
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2448)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2510)
at android.app.ActivityThread.access$1200(ActivityThread.java:163)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1371)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5595)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: java.lang.IllegalArgumentException: Cannot add a null child view to a ViewGroup
at android.view.ViewGroup.addView(ViewGroup.java:3790)
at net.wequick.small.webkit.WebActivity.onCreate(WebActivity.java:104)
at android.app.Activity.performCreate(Activity.java:6100)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1109)
at net.wequick.small.ApkBundleLauncher$InstrumentationWrapper.callActivityOnCreate(ApkBundleLauncher.java:136)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2401)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2510)
at android.app.ActivityThread.access$1200(ActivityThread.java:163)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1371)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5595)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
多玩一会web.about 点进去新浪微博 多做一些操作 就会出现上面的bug
原因为 ClassLoader 找不到 A.0 类,luanchActivity出错
资源类插件(如web.about)打包时,我们需要对其构造一个二进制的AndroidManifest.xml
文件,从而使得
packageManager.getPackageArchiveInfo
可以取得PackageInfo
,
进而得到插件的versionCode
[1]与signatures
[2]等信息。
其中[1]用于插件升级,[2]用于插件签名校验。
现在的处理方法:
i) 构造文本文件AndroidManifest.xml
ii) 使用aapt -M
打包,生成一个压缩包
iii) 解压该压缩包,得到二进制AndroidManifest.xml
要做的就是一步到位,直接生成二进制文件。
要修改的代码:
buildSrc/src/main/groovy/net/wequick/gradle/aapt/AXmlEditor.groovy
def createAndroidManefist(Map options) {
// Do stuff.
}
buildSrc/src/main/groovy/net/wequick/gradle/aapt/Aapt.groovy
void manifest(Map options) {
// TODO: generate hex file without aapt
File file = new File(mAssetDir, 'AndroidManifest.xml')
AXmlEditor editor = new AXmlEditor(file)
editor.createAndroidManifest(options)
}
不支持Lib使用第三方项目带有anim文件,使用第三方的项目是https://github.com/afollestad/material-dialogs
报错如下:
FAILURE: Build failed with an exception.
Missing library resource entry: "anim/popup_enter", try to cleanLib and buildLib.
在Small中ApkBundleLauncher的loadBundle()方法中添加以下代码:
String bundleApplicationName = pluginInfo.applicationInfo.className;
try {
if(bundleApplicationName != null)
{
Class applicationClass = Class.forName(bundleApplicationName);
Application bundleApplication = (Application) applicationClass.newInstance();
bundleApplication.onCreate();
}
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
错误: 找不到符号
TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.TwoLevelCategoryPicker);
^
符号: 变量 styleable
位置: 类 R
请问采用该框架的时候能否读取在xml文件中定义的自定义属性
我在lib.utils里引入了Volley的框架.
在执行gradlew buildLib 的时候把length为负数的异常.
如题.
你好,我看到Small项目的Todo List里计划要做这个事情,有两个问题:
1.iOS工程中的代码和framework都是要经过apple签名后才能够使用,这个问题是怎么绕过的?
2.是否有被apple发现,然后下架的风险
Gradle一直download jcenter small-0.11.aar
我的project build.gradle 配置如下:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'net.wequick.tools.build:gradle-small:0.1.1'
}
}
allprojects {
repositories {
jcenter()
}
}
apply plugin: 'net.wequick.small'
if (be.type != 'id') {
throw new Exception(
"Missing library resource entry: \"$k\", try to cleanLib and buildLib.")
}
不知道是不是这个原因引起的?
i download the sample code and build it, there're some errors:
/home/tangsir/study/android/small/Small/Android/Sample/app.home/src/main/java/net/wequick/example/small/app/home/MainFragment.java
Error:(100, 53) 错误: 找不到符号
符号: 方法 findByName(String)
位置: 类 Bundle
Error:(102, 67) 错误: 找不到符号
符号: 方法 getPatchFile()
位置: 类型为Bundle的变量 bundle
Error:(174, 31) 错误: 找不到符号
符号: 方法 upgrade()
位置: 类型为Bundle的变量 bundle
3 个错误
Error:Execution failed for task ':app.home:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
pod 安装不成功
Process: net.wequick.example.small.app.main, PID: 19034
java.lang.RuntimeException: Unable to start activity ComponentInfo{net.wequick.example.small.app.main/net.wequick.small.webkit.WebActivity}: java.lang.UnsupportedOperationException: This isn't a hierarchical URI.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2209)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2258)
at android.app.ActivityThread.access$800(ActivityThread.java:147)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1211)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5135)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:611)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.UnsupportedOperationException: This isn't a hierarchical URI.
at android.net.Uri.getQueryParameter(Uri.java:1662)
at net.wequick.small.webkit.WebActivity.onCreate(WebActivity.java:60)
at android.app.Activity.performCreate(Activity.java:5361)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2163)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2258)
at android.app.ActivityThread.access$800(ActivityThread.java:147)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1211)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5135)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:611)
at dalvik.system.NativeStart.main(Native Method)
net.wequick.example.small.app.main D/Chrome: TCPSocketLibevent::OnFileReadWriteTimeout(fd=140)
根据指示建的MySmall工程不能正常运行,停留在launchactivity中,不能跳转到app.main。
新建bundles.json文件
应改为bundle.json
在app 里面无法引用 lib.util 或者lib.style
[Small] building library 1 of 3 - app (0x7f)
[Small] building library 3 of 3 - lib.utils (0x73)
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':lib.utils:processReleaseResources'.
> Missing resolving for resource: [vtype:int, type:anim, key:abc_fade_in, typeId:5, entryId:0, idStr:0x7f050000, id:2131034112, isStyleable:false, _typeId:99, _entryId:-1]
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
应该是build gradle-small-plugin的时候用了java8生成包,android build系统只支持到7.
建议在文档里加一个说明
如果碰到这种情况 需要在gradle-small-plugin的 build.gradle指定一下java6或者java7
sourceCompatibility = 1.7
看了资源打包那段,“我们的最终方案是对资源包进行重新打包,重设资源id”,是指插件包的资源重新打包么? 宿主发布之后,后续更新插件包单独编译不会引起资源id冲突问题吧
加载SD卡的插件.so资源,运行时报错:
`java.lang.NullPointerException
at net.wequick.small.AssetBundleLauncher.prelaunchBundle(AssetBundleLauncher.java:124)
at net.wequick.small.AssetBundleLauncher.launchBundle(AssetBundleLauncher.java:136)
at net.wequick.small.Bundle.launchFrom(Bundle.java:357)
at net.wequick.small.Small.openUri(Small.java:250)
at net.wequick.small.Small.openUri(Small.java:231)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.