Posts
Showing posts from January, 2018
react-native : multi language support set up, use device locale, react-native-i18n use example
- Get link
- Other Apps
Multi language prepare .\app\i18n\locales\en.js export default { wcsqa: 'Westminster Shorter Catechism Q&A' }; .\app\i18n\locales\zh.js export default { wcsqa: '威斯敏斯德小要理问答' }; .\app\i18n\i18n.js import I18n from 'react-native-i18n'; import en from './locales/en'; import zh from './locales/zh'; I18n.fallbacks = true; I18n.translations = { en, zh }; export default I18n; Usage App.js import ReactNativeLanguages from 'react-native-languages'; import I18n from './app/i18n/i18n' ReactNativeLanguages.addEventListener('change', ({ language }) => { I18n.locale = language; }); render() { return ( <View style={styles.container}> <View style={styles.header}> <Text style={styles.title}> {I18n.t('wcsqa')} </Text> ... // other contents </View> ... // other contents </View> ) }
react-native : header bar(title + option button) example
- Get link
- Other Apps
Render render() { return ( <View style={styles.container}> <View style={styles.header}> <Text style={styles.title}> {I18n.t('wcsqa')} // your title </Text> <TouchableOpacity onPress={() => {}}> <Image style={styles.option} source={require('./res/img/nav_icon.png')} /> </TouchableOpacity> </View> <View style={styles.content}> <Text> {this.wcs[0].Q} // your content </Text> </View> </View> ) } Style const styles = StyleSheet.create({ container: { flex: 2, }, header: { backgroundColor: '#00FF7F', flex: 1, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-around', }, title: {
language code for Chinese should be start with 'zh'
- Get link
- Other Apps
According to RFC4646 ( http://www.ietf.org/rfc/rfc4646.txt ) language codes for Traditional Chinese should be zh-Hant react-native-i18n import { getLanguages } from 'react-native-i18n' getLanguages().then(languages => { console.log(languages); }); Set system language to Chinese 01-24 17:47:47.957 19851 19873 I ReactNativeJS: [ 'zh-Hans-CN', 'en-US' ] Set system language to English 01-24 17:56:30.754 20563 20584 I ReactNativeJS: [ 'en-US', 'zh-Hans-CN' ]
react-native run-android : Unable to process incoming event ‘ProgressComplete ’ (ProgressCompleteEvent) on Windows
- Get link
- Other Apps
Error Unable to process incoming event 'ProgressComplete ' (ProgressCompleteEvent) on Windows Solution I looked solution from web, but not found one can work for my issue. https://github.com/gradle/gradle/issues/882 Then I just closed my shell window(cmd.exe or powershell.exe) and reopen a new one, I found the issue gone.
react-native : full screen background image example
- Get link
- Other Apps
render render() { return ( <ImageBackground style={styles.bgimg} source={require('./res/img/wcs.png')}> <View style={styles.fgcontainer}> <Text style={styles.qa}> WCS WCS WCS </Text> </View> </ImageBackground> ); } Style const styles = StyleSheet.create({ bgimg: { flex: 1 }, fgcontainer: { flex: 1, justifyContent: 'center', alignItems: 'center' }, qa: { fontSize: 30, fontWeight: 'bold' } }); No Image, No Truth
react-native : center an Image example
- Get link
- Other Apps
Render render() { return ( <View style={styles.splashContainer}> <Image source={require('./res/img/Catechism-words.png')}> </Image> </View> ) } Style const styles = StyleSheet.create({ splashContainer: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#00FF7F' } }); No Image, No True
chromium : extensions, how a extension list on web store was installed to chrome
- Get link
- Other Apps
If you find a liked extension on chrome web store , you can install it just by simple click the "ADD TO CHROME" button. Let's go deep into chromium codes, and see how it happened. The key module is chrome.webstore, which a buildin JS object in chrome. chrome/renderer/extensions/webstore_bindings.cc chrome/renderer/extensions/webstore_bindings.h WebstoreBindings::Install TabHelper::DoInlineInstall WebstoreInlineInstaller::BeginInstall WebstoreStandaloneInstaller::ProceedWithInstallPrompt ShowInstallUI show install prompt dialog WebstoreStandaloneInstaller::ProceedWithInstallPrompt NavigationObserver::OnInstallPromptDone ExtensionService::EnableExtension ExtensionRegistrar::EnableExtension
chromium : extensions, how background scripts/page get loaded.
- Get link
- Other Apps
Summary a generated background page such as chrome-extension://ffdhgjkakefolmigapfdgbcneopmidbf/_generated_background_page.html will be loaded soon afer extensions service init. the content of background page is generated by GeneratedBackgroundPageJob. specially for scheme "chrome-extension://" GenerateBackgroundPageContents #3 0x56110ab93b63 extensions::(anonymous namespace)::GeneratedBackgroundPageJob::GetData() #4 0x7fb7125791e9 net::URLRequestSimpleJob::GetRefCountedData() #5 0x7fb712578baf net::URLRequestSimpleJob::StartAsync() extensions::CreateExtensionProtocolHandler void ProfileIOData::SetUpJobFactoryDefaultsForBuilder( net::URLRequestContextBuilder* builder, content::URLRequestInterceptorScopedVector request_interceptors, std::unique_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> protocol_handler_interceptor) const { // NOTE(willchan): Keep these protocol handlers in sync with // ProfileIOData::IsHandled
chromium : extensions, how content scripts get executed
- Get link
- Other Apps
extensions::Dispatcher::RunScriptsAtDocumentEnd #2 0x5595477272c3 extensions::Dispatcher::RunScriptsAtDocumentEnd() #3 0x55954c42bb3c ChromeExtensionsRendererClient::RunScriptsAtDocumentEnd() #4 0x55954c382721 ChromeContentRendererClient::RunScriptsAtDocumentEnd() #5 0x7ff32f28b88c content::RenderFrameImpl::RunScriptsAtDocumentReady() #6 0x7ff3226b9739 blink::LocalFrameClientImpl::RunScriptsAtDocumentReady() #7 0x7ff322f6de36 blink::FrameLoader::FinishedParsing() #8 0x7ff32239b40b blink::Document::FinishedParsing() #9 0x7ff323a6a773 blink::HTMLConstructionSite::FinishedParsing() #10 0x7ff323adf2d7 blink::HTMLTreeBuilder::Finished() #11 0x7ff323a7e316 blink::HTMLDocumentParser::end() #12 0x7ff323a74c7f blink::HTMLDocumentParser::AttemptToRunDeferredScriptsAndEnd() #13 0x7ff323a749a6 blink::HTMLDocumentParser::PrepareToStopParsing() #14 0x7ff323a7a9cc blink::HTMLDocumentParser::ProcessTokenizedChunkFromBackgroundParser() #15 0x7ff323a7657d blink::HTMLDocumentParser::P
chromium : how extension install prompt dialog get showed
- Get link
- Other Apps
#2 0x5589ca9aaeba ExtensionInstallPrompt::ShowDialog() #3 0x5589ca9aac7c ExtensionInstallPrompt::ShowDialog() #4 0x5589ca9aa96e ExtensionInstallPrompt::ShowDialog() #5 0x5589cb168cca extensions::WebstorePrivateBeginInstallWithManifest3Function::OnWebstoreParseSuccess() #6 0x5589cab3821b extensions::WebstoreInstallHelper::ReportResultsIfComplete() #7 0x5589cab37efd extensions::WebstoreInstallHelper::OnFetchComplete() #8 0x5589c85da07b chrome::BitmapFetcher::OnImageDecoded() #9 0x5589c85dc1d1 ImageDecoder::OnDecodeImageSucceeded() #10 0x5589c7303c4f _ZN4base8internal13FunctorTraitsIMN10extensions8internal26ScopedCallbackRunnerHelperIFvRKNSt3__16vectorIhNS5_9allocatorIhEEEEN6device5mojom18SerialReceiveErrorEEEEFvSB_SE_EvE6InvokeIPSG_JS9_SE_EEEvSI_OT_DpOT0_ #11 0x5589c7303baa _ZN4base8internal12InvokeHelperILb0EvE8MakeItSoIMN10extensions8internal26ScopedCallbackRunnerHelperIFvRKNSt3__16vectorIhNS7_9allocatorIhEEEEN6device5mojom18SerialReceiveErrorEEEEFvSD_SG_EJPSI_SB_SG_EEEvOT_DpOT0_
chromium : extensions load back trace
- Get link
- Other Apps
#2 0x55c01d36db9d extensions::ExtensionRegistry::AddEnabled() #3 0x55c01d3696cf extensions::ExtensionRegistrar::AddExtension() #4 0x55c020eda0f6 ExtensionService::AddExtension() #5 0x55c020f7e344 extensions::InstalledLoader::Load() #6 0x55c020f7f31b extensions::InstalledLoader::LoadAllExtensions() #7 0x55c020ed12e5 ExtensionService::Init() #8 0x55c020f10a82 extensions::ExtensionSystemImpl::Shared::Init() #9 0x55c020f11462 extensions::ExtensionSystemImpl::InitForRegularProfile() #10 0x55c01eb6419a ProfileManager::DoFinalInitForServices() #11 0x55c01eb63fd3 ProfileManager::DoFinalInit() #12 0x55c01eb65d73 ProfileManager::AddProfile() #13 0x55c01eb576d2 ProfileManager::CreateAndInitializeProfile() #14 0x55c01eb57227 ProfileManager::GetProfile() #15 0x55c0222cb5f8 GetStartupProfile() #16 0x55c01e6db67f (anonymous namespace)::CreatePrimaryProfile() #17 0x55c01e6d9366 ChromeBrowserMainParts::PreMainMessageLoopRunImpl() #18 0x55c01e6d85cc ChromeBrowserMainParts::PreMainMessageLoopRun() #19 0
chromium : How KeyedService was created
- Get link
- Other Apps
DependencyManager::CreateContextServices void DependencyManager::CreateContextServices(base::SupportsUserData* context, bool is_testing_context) { MarkContextLive(context); std::vector<DependencyNode*> construction_order; if (!dependency_graph_.GetConstructionOrder(&construction_order)) { NOTREACHED(); } #ifndef NDEBUG DumpContextDependencies(context); #endif for (auto* dependency_node : construction_order) { KeyedServiceBaseFactory* factory = static_cast<KeyedServiceBaseFactory*>(dependency_node); if (is_testing_context && factory->ServiceIsNULLWhileTesting() && !factory->HasTestingFactory(context)) { factory->SetEmptyTestingFactory(context); } else if (factory->ServiceIsCreatedWithContext()) { factory->CreateServiceNow(context); } } } #14 0x7f08ec0395de DependencyManager::CreateContextServices() #15 0x7f0
chromium : extensions UI(chrome://extensions) create back trace
- Get link
- Other Apps
#2 0x561c61ba4b95 (anonymous namespace)::GetWebUIFactoryFunction() #3 0x561c61ba35b2 ChromeWebUIControllerFactory::GetWebUIType() #4 0x561c61ba5962 ChromeWebUIControllerFactory::UseWebUIForURL() #5 0x7fe6df4aa299 content::WebUIControllerFactoryRegistry::UseWebUIForURL() #6 0x7fe6df4aa3f5 content::WebUIControllerFactoryRegistry::IsURLAcceptableForWebUI() #7 0x7fe6df4b2147 content::WebUIImpl::OnWebUISend() #8 0x7fe6df4b59ef _ZN3IPC20DispatchToMethodImplIN7content9WebUIImplEMS2_FvPNS1_15RenderFrameHostERK4GURLRKNSt3__112basic_stringIcNS8_11char_traitsIcEENS8_9allocatorIcEEEERKN4base9ListValueEES3_NS8_5tupleIJS5_SE_SI_EEEJLm0ELm1ELm2EEEEvPT_T0_PT1_OT2_NS8_16integer_sequenceImJXspT3_EEEE #9 0x7fe6df4b58d0 _ZN3IPC16DispatchToMethodIN7content9WebUIImplENS1_15RenderFrameHostEJRK4GURLRKNSt3__112basic_stringIcNS7_11char_traitsIcEENS7_9allocatorIcEEEERKN4base9ListValueEENS7_5tupleIJS4_SD_SH_EEEEENS7_9enable_ifIXeqsZT1_sr3std10tuple_sizeINS7_5decayIT2_E4typeEEE5valueEvE4typeEPT_MST_FvPT0_DpT1_ESW
chromium : extensions RendererStartupHelper InitializeProcess back trace
- Get link
- Other Apps
#2 0x561c5ce30032 extensions::RendererStartupHelper::InitializeProcess() #3 0x561c5ce2f331 extensions::RendererStartupHelper::Observe() #4 0x7fe6def2a33f content::NotificationServiceImpl::Notify() #5 0x7fe6df12ebac content::RenderProcessHostImpl::OnProcessLaunched() #6 0x7fe6de83aebc content::ChildProcessLauncher::Notify() #7 0x7fe6de83da40 content::internal::ChildProcessLauncherHelper::PostLaunchOnClientThread() #8 0x7fe6de83e529 _ZN4base8internal13FunctorTraitsIMN7content8internal26ChildProcessLauncherHelperEFvNS4_7ProcessEiEvE6InvokeI13scoped_refptrIS4_EJS5_iEEEvS7_OT_DpOT0_ #9 0x7fe6de83e43a _ZN4base8internal12InvokeHelperILb0EvE8MakeItSoIMN7content8internal26ChildProcessLauncherHelperEFvNS6_7ProcessEiEJ13scoped_refptrIS6_ES7_iEEEvOT_DpOT0_ #10 0x7fe6de83e3a3 _ZN4base8internal7InvokerINS0_9BindStateIMN7content8internal26ChildProcessLauncherHelperEFvNS5_7ProcessEiEJ13scoped_refptrIS5_ENS0_13PassedWrapperIS6_EEiEEEFvvEE7RunImplIS8_NSt3__15tupleIJSA_SC_iEEEJLm0ELm1ELm2EEEEvOT_OT0_NSH_
chromium : extensions::Extension construction back trace in Browser process
- Get link
- Other Apps
#2 0x55aaedfdafa6 extensions::Extension::Create() #3 0x55aaedfdaf22 extensions::Extension::Create() #4 0x55aaeec372eb extensions::ComponentLoader::CreateExtension() #5 0x55aaeec34321 extensions::ComponentLoader::Load() #6 0x55aaeec34100 extensions::ComponentLoader::LoadAll() #7 0x55aaeecc028c ExtensionService::Init() #8 0x55aaeecffa72 extensions::ExtensionSystemImpl::Shared::Init() #9 0x55aaeed00452 extensions::ExtensionSystemImpl::InitForRegularProfile() #10 0x55aaec95317a ProfileManager::DoFinalInitForServices() #11 0x55aaec952fb3 ProfileManager::DoFinalInit() #12 0x55aaec954d53 ProfileManager::AddProfile() #13 0x55aaec9466b2 ProfileManager::CreateAndInitializeProfile() #14 0x55aaec946207 ProfileManager::GetProfile() #15 0x55aaf00ba618 GetStartupProfile() #16 0x55aaec4ca65f (anonymous namespace)::CreatePrimaryProfile() #17 0x55aaec4c8346 ChromeBrowserMainParts::PreMainMessageLoopRunImpl() #18 0x55aaec4c75ac ChromeBrowserMainParts::PreMainMessageLoopRun() #19 0x7f1d0223d1e4 content::B
chromium : extensions::Extension construction back trace in Render process
- Get link
- Other Apps
extensions/renderer/dispatcher.cc extensions::Dispatcher receive ExtensionMsg_Loaded from extensions/browser/renderer_startup_helper.cc RendererStartupHelper::InitializeProcess // Loaded extensions. std::vector<ExtensionMsg_Loaded_Params> loaded_extensions; BrowserContext* renderer_context = process->GetBrowserContext(); const ExtensionSet& extensions = ExtensionRegistry::Get(browser_context_)->enabled_extensions(); for (const auto& ext : extensions) { // OnLoadedExtension should have already been called for the extension. DCHECK(base::ContainsKey(extension_process_map_, ext->id())); DCHECK(!base::ContainsKey(extension_process_map_[ext->id()], process)); if (!IsExtensionVisibleToContext(*ext, renderer_context)) continue; // TODO(kalman): Only include tab specific permissions for extension // processes, no other process needs it, so it's mildly wasteful. // I am not sure this is possible to know this
nginx : set up http/https conf for your server(Ghost)
- Get link
- Other Apps
Let me use cluster.errong.win as a example. All you need to do is replace the server name and port. All reqest to cluster.errong.win will be proxyed by http://127.0.0.1:6666 http conf server { listen 80; listen [::]:80; server_name cluster.errong.win; root /home/errong_leng/www/cluster/system/nginx-root; location / { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $http_host; proxy_pass http://127.0.0.1:6666; } location ~ /.well-known { allow all; } client_max_body_size 50m; } enable http server to nginx ln -sf /home/errong_leng/www/cluster/system/files/cluster.errong.win.conf /etc/nginx/sites-available/cluster.errong.win.conf ln -sf /etc/nginx/sites-available/cluster.errong.win.conf /etc/nginx/sites-enabled/cluster.errong.win.conf Use Let's Encrypt Le
android studio : CreateProcess error=216, This version of %1 is not compatible with the version of Windows you're running
- Get link
- Other Apps
Error CreateProcess error=216, This version of %1 is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher Solution I Your sdk location not match, select the real sdk location Someone says it works, but not for me. Solution II REASON This happens because for now they only ship 64bit JRE with Android Studio for Windows which produces glitches in 32 bit systems. SOLUTION do not use the embedded JDK: Go to File -> Project Structure dialog, uncheck "Use embedded JDK" and select the 32-bit JRE you've installed separately in your system decrease the memory footprint for Gradle in gradle.properties(Project Properties), for eg set it to -Xmx768m. For more details: https://code.google.com/p/android/issues/detail?id=219524
react-native : navigate/load url via WebView
- Get link
- Other Apps
No Image, No Truth use WebView component in reactnative. var { ...., WebView, } = React; initial state give a default url getInitialState: function() { return { url: '', // or default url }; }, render with state url <WebView ....your styles, properties url={this.state.url} /> Navigate/load codes load() { this.setState({url:'http://google.com'}); } Full Sample Codes import React, { Component } from 'react'; import { Button, Modal, Image, Keyboard, NativeModules, Platform, StyleSheet, Text, TextInput, TouchableOpacity, View, WebView, } from 'react-native'; const { WeChat } = NativeModules; const SHARE_TO_WXTIMELINE = 0; const SHARE_TO_WXSESSION = 1; const webview = "webview"; const HOME_URL = " https://errong.win "; export default class App extends Component<{}> { componentWillMount () { this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', () => {this.k
react-native : Modal example, share to WeChat
- Get link
- Other Apps
Refer https://facebook.github.io/react-native/docs/modal.html No Image, No Truth Full Codes import React, { Component } from 'react'; import { Button, Modal, Image, Keyboard, NativeModules, Platform, StyleSheet, Text, TextInput, TouchableOpacity, View, WebView, } from 'react-native'; const { WeChat } = NativeModules; const SHARE_TO_WXTIMELINE = 0; const SHARE_TO_WXSESSION = 1; const webview = "webview"; const HOME_URL = "https://errong.win"; export default class App extends Component<{}> { componentWillMount () { this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', () => {this.keyboardDidHide()}); } componentWillUnmount () { this.keyboardDidHideListener.remove(); } keyboardDidHide () { console.log( this.urlText ); if (this.urlText != null) { this.setState({url:this.urlText}); } } constructor(props) { super(props);
react-native : How to create Image Button
- Get link
- Other Apps
Solution Use TouchableOpacity , Image and Styles . Key codes import React, { Component } from 'react'; import { Image, StyleSheet, TouchableOpacity, } from 'react-native'; <TouchableOpacity style={styles.sharebutton} onPress={() => {this.onShare(SHARE_TO_WXTIMELINE)}} > <Image source={require('./res/img/wxtimeline.png')} /> </TouchableOpacity> No Image, No Truth See Full sample codes Share to WeXin via Modal
react-natvie run-android --variant=release uncompiled PNG file passed as argument. Must be compiled first into .flat file..
- Get link
- Other Apps
C:\Users\lenger\Desktop\webrowser\android\app\build\intermediates\res\merged\release\drawable-mdpi\res_icon64_appwx_logo .png: error: uncompiled PNG file passed as argument. Must be compiled first into .flat file.. error: failed parsing overlays. Task :app:processReleaseResources Failed to execute aapt com.android.ide.common.process.ProcessException: Failed to execute aapt workaround android\gradle.properties android.enableAapt2=false refer https://github.com/react-navigation/react-navigation/issues/3097
wechat share for react native app on android platform
- Get link
- Other Apps
Register App on weixin open platform Register your on https://open.weixin.qq.com While registering your app, you will need app sign signature, you can refer sign your app for weixin . You will get your APPID after your app registered. please keep it. prepare wechat sdk for you app add wechat sdk in android/app/build.gradle dependencies { compile 'com.tencent.mm.opensdk:wechat-sdk-android-with-mta:+' } set up AndroidManifest.xml <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> <uses-permission android:name="android.permission.READ_PHONE_STATE"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> build native wechat to react native JS I export wechat as "NativeModules.WeChat" follow below examp
react-native : Native Modules, name prefix "RCT"works for android too
- Get link
- Other Apps
I tried to export wechat sdk as a native module. I copied some codes here: public class WeChatModule extends ReactContextBaseJavaModule implements IWXAPIEventHandler { private String appId; public WeChatModule(ReactApplicationContext context) { super(context); } @Override public String getName() { return "RCTWeChat"; } } I used "RCTWeChat" as the module name, I did not know the "RCT" prefix meanings. ReactContextBaseJavaModule requires that a method called getName is implemented. The purpose of this method is to return the string name of the NativeModule which represents this class in JavaScript. Then I encountered error in my react-native JS codes. import {NativeModules} from 'react-native'; const { RCTWeChat } = NativeModules; WeChat or NativeModules.RCTWeChat always undefined. Cause RCT is a prefix used in react native, it will be removed when exported to JS. React Native uses RCT as a prefix. In
react-native run-android : No connected devices!
- Get link
- Other Apps
react-native run-android : sun.security.provider.cert path.SunCertPathBuilderException : unable to find valid certification path to req uested target
- Get link
- Other Apps
F:\webrowser>react-native run-android Scanning folders for symlinks in F:\webrowser\node_modules (73ms) Starting JS server... Building and installing the app on the device (cd android && gradlew.bat install Debug)... Downloading https://services.gradle.org/distributions/gradle-4.1-all.zip Exception in thread "main" javax.net.ssl.SSLHandshakeException: sun.security.val idator.ValidatorException: PKIX path building failed: sun.security.provider.cert path.SunCertPathBuilderException: unable to find valid certification path to req uested target at sun.security.ssl.Alerts.getSSLException(Alerts.java:192) at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1959) at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:302) at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:296) at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker. java:1514) at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.jav a:216) at s
error: package com.tencent.mm.sdk.openapi does not exist
- Get link
- Other Apps
Task :app:compileReleaseJavaWithJavac C:\Users\lenger\Desktop\webrowser\android\app\src\main\java\com\wx\react\WeChatModule.java:9: error: package com.tencent.mm.sdk.openapi does not exist import com.tencent.mm.sdk.openapi.IWXAPIEventHandler; ^ C:\Users\lenger\Desktop\webrowser\android\app\src\main\java\com\wx\react\WeChatModule.java:11: error: cannot find symbol public class WeChatModule extends ReactContextBaseJavaModule implements IWXAPIEventHandler { ^ symbol: class IWXAPIEventHandler 2 errors FAILURE: Build failed with an exception. solution com.tencent.mm.sdk ==> com.tencent.mm.opensdk
gradle build : Could not find method compile() for arguments
- Get link
- Other Apps
In build.gradle file add one of the following: dependencies { compile 'com.tencent.mm.opensdk:wechat-sdk-android-with-mta:+' } What went wrong: A problem occurred evaluating root project 'webrowser'. Could not find method compile() for arguments [com.tencent.mm.opensdk:wechat-sdk-android-with-mta:+] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. Cause edit wrong android/build.gradle Solution edit correct android/app/build.gradle.
install GNU tools via chocolatey for windows
- Get link
- Other Apps
https://chocolatey.org/install @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString(' https://chocolatey.org/install.ps1 '))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" choco install -y gnuwin32-coreutils.install choco install gnuwin32-grep.install -y choco install which -y choco install git -y choco install vim -y C:\Users\lenger>which rm C:\Program Files (x86)\GnuWin32\bin\rm.exe C:\Users\lenger>which which C:\ProgramData\chocolatey\bin\which.exe C:\Users\lenger>which ls C:\Program Files (x86)\GnuWin32\bin\ls.exe C:\Users\lenger>which grep C:\Program Files (x86)\GnuWin32\bin\grep.exe C:\Users\lenger>which mv C:\Program Files (x86)\GnuWin32\bin\mv.exe C:\Users\lenger>which mkdir C:\Program Files (x86)\GnuWin32\bin\mkdir.exe
react-native : communicate between react-native JS and WebView component
- Get link
- Other Apps
APIs: window.postMessage in WebView , post a message to react-native JS . onMessage callback in react-native JS , receive a message from WebView . injectjavascript , Function that accepts a string that will be passed to the WebView and executed immediately as JavaScript. injectedjavascript , Set this to provide JavaScript that will be injected into the web page when the view loads. onMessage A function that is invoked when the webview calls window.postMessage. Setting this property will inject a postMessage global into your webview, but will still call pre-existing values of postMessage. window.postMessage accepts one argument, data, which will be available on the event object, event.nativeEvent.data. data must be a string. Sample code import React, { Component } from 'react'; import { Button, Platform, StyleSheet, Text, View, WebView, } from 'react-native'; var WEBVIEW_REF = 'webview'; export default class App extends Component<
Let's Growing up in Jesus
- Get link
- Other Apps
看你们学习的工夫,本该作师傅,谁知还得有人将 神圣言小学的开端另教导你们,并且成了那必须吃奶、不能吃干粮的人。 (希伯来书 5:12 和合本) In fact, though by this time you ought to be teachers, you need someone to teach you the elementary truths of God's word all over again. You need milk, not solid food! (Hebrews 5:12 NIV) 凡只能吃奶的都不熟练仁义的道理,因为他是婴孩; (希伯来书 5:13 和合本) Anyone who lives on milk, being still an infant, is not acquainted with the teaching about righteousness. (Hebrews 5:13 NIV) 惟独长大成人的才能吃干粮;他们的心窍习练得通达,就能分辨好歹了。 (希伯来书 5:14 和合本) But solid food is for the mature, who by constant use have trained themselves to distinguish good from evil. (Hebrews 5:14 NIV) Photo by Milos Prelevic / Unsplash
react-native run-android : Command `run-android` unrecognized
- Get link
- Other Apps
npm ERR! code UNABLE_TO_VERIFY_LEAF_SIGNATURE
- Get link
- Other Apps
F:\webrowser>npm install -g react-native-cli npm ERR! code UNABLE_TO_VERIFY_LEAF_SIGNATURE npm ERR! errno UNABLE_TO_VERIFY_LEAF_SIGNATURE npm ERR! request to https://registry.npmjs.org/react-native-cli failed, reason: unable to verify the first certificate npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache_logs\2018-01-11T1 6_55_54_266Z-debug.log solution npm config set strict-ssl false F:\webrowser>npm install -g react-native-cli C:\Users\Administrator\AppData\Roaming\npm\react-native -> C:\Users\Administrato r\AppData\Roaming\npm\node_modules\react-native-cli\index.js react-native-cli@2.0.1 added 41 packages in 23.687s
git clone : SSL cert ificate problem: unable to get local issuer certificate
- Get link
- Other Apps
F:>git clone https://github.com/lengerrong/webrowser.git Cloning into 'webrowser'... fatal: unable to access ' https://github.com/lengerrong/webrowser.git/ ': SSL cert ificate problem: unable to get local issuer certificate F:>git config --global http.sslVerify false F:>git clone https://github.com/lengerrong/webrowser.git Cloning into 'webrowser'... remote: Counting objects: 134, done. remote: Compressing objects: 100% (90/90), done. Receiving objects: 33% (45/134), 492.00 KiB | 17.00 KiB/s
Generate Signed android APK for react-native app
- Get link
- Other Apps
Refer: https://facebook.github.io/react-native/docs/signed-apk-android.html create your own key store file https://errong.win/generate-keystore/ modifications error INSTALL_FAILED_UPDATE_INCOMPATIBLE https://errong.win/react-native-run-android-variant-release/ java.lang.NullPointerException (no error message) When I set below values to true, I encountered NullPointerException. so my reset them to false again. + def enableSeparateBuildPerCPUArchitecture = true + universalApk true // If true, also generate a universal APK + def enableProguardInReleaseBuilds = true error can't delete/read lint-results-release-fatal.html kill all java.exe via task manager
set up proxy for android emulator
- Get link
- Other Apps
c:\Users\lenger\AppData\Local\Android\Sdk\tools>emulator.exe -http-proxy ip:port -avd Nexus_5X_API_23 c:\Users\lenger\AppData\Local\Android\Sdk\tools>bin\avdmanager.bat list avd Name: Nexus_5X_API_23 Device: Nexus 5X (Google) Path: C:\Users\lenger\.android\avd\Nexus_5X_API_23.avd Target: Google APIs (Google Inc.) Based on: Android 6.0 (Marshmallow) Tag/ABI: google_apis/x86_64 Skin: nexus_5x Sdcard: 100M --------- Name: Nexus_5X_API_23_2 Device: Nexus 5X (Google) Path: C:\Users\lenger\.android\avd\Nexus_5X_API_23_2.avd Target: Google APIs (Google Inc.) Based on: Android 6.0 (Marshmallow) Tag/ABI: google_apis/armeabi-v7a Skin: nexus_5x Sdcard: 100M --------- Name: Nexus_5X_API_27_x86 Device: Nexus 5X (Google) Path: C:\Users\lenger\.android\avd\Nexus_5X_API_27_x86.avd Target: Google APIs (Google Inc.) Based on: Android API 27 Tag/ABI: google_apis/x86 Skin: nexus_5x Sdcard: 800M Snapshot: no
react-native run-android --variant=release INSTALL_FAILED_UPDATE_INCOMPATIBLE
- Get link
- Other Apps
Task :app:installRelease Installing APK 'app-release.apk' on 'Nexus_5X_API_23(AVD) - 6.0' for app:release Unable to install C:\Users\lenger\Desktop\webrowser\android\app\build\outputs\apk\release\app-release.apk com.android.ddmlib.InstallException: INSTALL_FAILED_UPDATE_INCOMPATIBLE at com.android.ddmlib.Device.installRemotePackage(Device.java:1004) at com.android.ddmlib.Device.installPackage(Device.java:911) at com.android.builder.testing.ConnectedDevice.installPackage(ConnectedDevice.java:122) at com.android.build.gradle.internal.tasks.InstallVariantTask.install(InstallVariantTask.java:171) at com.android.build.gradle.internal.tasks.InstallVariantTask.install(InstallVariantTask.java:105) at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73) at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.doExecute(DefaultTaskClassInfoStore.java:141) at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInf