I followed the instruction to install native-base from nativebase.io and to setup the project. I was successful at that, after running the command react-native run-android I get a successful message in the CMD telling
BUILD SUCCESSFUL
Total time: 15.051 secs
'adb' is not recognized as an internal or external command,
operable program or batch file.
Starting the app (C:\Users\DELL\AppData\Local\Android\sdk/platform-tools/adb
shell am start -n
com.awesomenativebase/com.awesomenativebase.MainActivity...
Starting: Intent { cmp=com.awesomenativebase/.MainActivity }
but, I get the following error in my App that is running in my physical device(Samsung kitkat 4.4.4):
My code in App.js:
import React, { Component } from 'react';
import { Container, Header, Title, Content, Footer, FooterTab, Button, Left,
Right, Body, Icon, Text } from 'native-base';
export default class AnatomyExample extends Component {
render() {
return (
<Container>
<Header>
<Left>
<Button transparent>
<Icon name='menu' />
</Button>
</Left>
<Body>
<Title>Header</Title>
</Body>
<Right />
</Header>
<Content>
<Text>
This is Content Section
</Text>
</Content>
<Footer>
<FooterTab>
<Button full>
<Text>Footer</Text>
</Button>
</FooterTab>
</Footer>
</Container>
);
}
Can anyone help on this? Thank you.
First make sure that the both devices (physical device & the device on which the code is running) on the same network.
Shake the physical device, it opens the debugger options.
Go to Dev Settings -> Debug server host & port for device.
It should be empty if you're device is connected by usb otherwise enter the ip address of your laptop followed by the port on which the packager is running.
For e.g 12:34:56:78:8081
Related
I have a Vue2 App, when i try to use vue-cordova-cli on mine app for deploy on android's device, it doesn't works and only look a with blank screen, i look for all sites of internet for look the solution with not luck.
I display you the configuration that i have:
System Operative: Windows 10
CLI: Powershell (Administrative Privilege)
Android: 7.1.1
Commands npm
vue add cordova
npm run cordova-prepare
npm run cordova-serve-android
main.js
import Vue from 'vue'
import App from './App.vue'
Vue.config.productionTip = false
new Vue({
render: h => h(App),
}).$mount('#app')
vue.config.js
module.exports = {
publicPath: '',
pluginOptions: {
cordovaPath: 'src-cordova'
}
}
More info: All my test are doing using my device connect to my pc using a usb link and i have a lot of deploy previously to that using that way.
I'm new in app dev and I wanted to start with vue native and as I saw in the documentation,vue native is not able to acces some device API's like local file,but react native can and vue is just wrapper around the React Native,
So how can I use import react native compoment and API's inside vue project?
and use expo to development
For example ionicons:
In script part:
import { Ionicons } from "#expo/vector-icons";
export default {
components: {Ionicons},
}
After that you can use it in template:
<template>
<view class="container">
<ionicons name="md-checkmark-circle" size=92 color="green" />
</view>
</template>
You can see examples here:
https://vue-native.io/docs/community-libraries-doc.html
Another example with Expo-Speech:
Installing package:
expo install expo-speech
Add it in script:
import * as Speech from 'expo-speech';
export default {
methods: {
sayHi: function(){
Speech.speak('Hi');
}
}
}
In template:
<template>
<view class="container">
<button title="Say Hi" :on-press="sayHi" />
</view>
</template>
Good luck!
I am currently using Ionic 3 and I found a pretty weird bug(?). On android I use the fullscreen option in the config.xml and also in the app.component.ts file
config.xml:
<preference name="FullScreen" value="true" />
app.component.ts:
keyboard.disableScroll(true);
keyboard.hideKeyboardAccessoryBar(true);
this.androidFullScreen.isImmersiveModeSupported()
.then(() => this.androidFullScreen.immersiveMode())
.catch((error: any) => console.log(error));
statusBar.hide();
statusBar.overlaysWebView(false);
And it is working well until I start using an input and when the keyboard shows up the status bars are also get visible until a minimize the app and open again.
Here is a gif about the promlem:
I figured it out.
So the problem was the cordova plugin not installed properly and also throw an error because of some permission thing. If this also happening with your application just run this:
ionic cordova build android --verbose
This will also throw a permission error, but it will output the folder where you don't have the right permission and after run on the folder:
sudo chmod 755
I am using this SSDP gem
It depends on ipaddr, socket
I have addedd ipaddr to the main Rhodes gem framework.
I modified the ssdp gem and included the contents inside its lib folder to the main framework as well.
Upon compilation of the app, it shows no error. Neither the adb log shows any error. But there is no output.
Wonder if the gem functionality is not supported or there is some system error?
The SSDP gem creates a UDP socket to listen to Upnp devices on a network.
That is my goal. To build a Upnp control point in Rhodes.
It requires access to native HTTP services, like sending requests over TCP/IP and UDP.
It also needs to serve music files from the phone over network.
It would also need to handle custom HTTP methods apart from GET/POST, like NOTIFY and SUBSCRIBE
As of now I am attempting task 1 and I dont see any errors in the adb. But it is not working.
This is the adb log - https://paste.ubuntu.com/26328082/
Testing on Android 6
EDIT
In application.rb
require 'socket'
require 'ipaddr'
require 'ssdp'
In index.erb
<%= finder = SSDP::Consumer.new :timeout => 3 %> <br />
<%= result = finder.search :service => 'ssdp:all' %> <br />
<%= IPAddr.new('239.255.255.250').hton + IPAddr.new('0.0.0.0').hton %> <br />
<%= Rho::Network.hasNetwork %> <br />
<%= result %>
The above code returns nothing in the Rhodes app.
Except IPAddr, which returns gibberish symbols. Only that works.
I am building a React Native mobile application that is using a Laravel backend, currently running on localhost:8000. When making a fetch request from an Android device to my server, my application gets the following error logs:
My code is below:
export default class App extends Component {
login() {
fetch('http://localhost:8000/api/establishments/get')
.then((response) => response.json())
.then((responseJson) => {
console.log('success!');
})
.catch((error) => {
console.error(error);
});
}
render() {
return (
<TouchableOpacity activeOpacity={.5} onPress={() => this.login()}>
<Text>Sign In</Text>
</TouchableOpacity>
);
}
}
When I copy and paste the exact route into my browser, the server responds successfully and completely as expected. I believe it is an issue with network permissions from my application? I have only just began learning React Native a week ago and would appreciate any help at all.
iOS runs in a simulator while Android runs in an emulator.
Emulator emulates a real device, while simulator only imitates a device.
Therefore localhost on Android points to the emulated Android device instead of the machine where your server runs.
You should change localhost in yours request paths with the IP address of your machine.
More details at: https://github.com/facebook/react-native/issues/10404#issuecomment-267303151
I suspect that 127.0.0.1 or localhost will point to the emulator itself in your computer where the server is currently running. Try replacing 127.0.0.1 / localhost with 10.0.2.2 if you are on AVD or 10.0.3.2 if you are on Genymotion or with your computer's actual IP address. In addition, you should also make sure that your android app can use internet. You can do that by adding
<uses-permission android:name="android.permission.INTERNET" />
in your AndroidManifest.xml.
Founded solution for Laravel and react native (Physical device)
open cmd run ipconfig copy ipv4 address for example my ipv4 address is 192.168.43.235
Connect same network for laptop and physical device or open hotspot and connect same network
Now run command start laravel backend php artisan serve --host=192.168.43.235 --port=8000
change api url from react native api service
apiServise.js
import axios from 'axios';
const api_url = 'http://192.168.43.235:8000';
export const getCategories = request =>
axios
.get(api_url + '/api/categories', {
params: request || {},
})
.then(response => response.data);
homescreen.js
import {getCategories} from '../services/ApiService';
async fetchCategories() {
await getCategories()
.then(response => {
this.setState({
dataCategories: response
});
})
.catch(error => {
console.log(error);
});
}
Now run command start react native app react-native run-android
that is all...now api request working fine.
Change http://localhost:8000/api/establishments/get localhost with, which can your emulator reach generally 10.0.2.2 ;) have phun.