Merge pull request #270 from realm/sk-port-forward
Automatically forward port 8082 for Android
This commit is contained in:
commit
ab94f5f314
|
@ -8,6 +8,5 @@ PATH="/opt/android-sdk-linux/platform-tools:$PATH"
|
||||||
npm install realm
|
npm install realm
|
||||||
|
|
||||||
adb reverse tcp:8081 tcp:8081
|
adb reverse tcp:8081 tcp:8081
|
||||||
adb forward tcp:8082 tcp:8082
|
|
||||||
|
|
||||||
react-native run-android
|
react-native run-android
|
||||||
|
|
|
@ -8,6 +8,5 @@ PATH="/opt/android-sdk-linux/platform-tools:$PATH"
|
||||||
npm install realm
|
npm install realm
|
||||||
|
|
||||||
adb reverse tcp:8081 tcp:8081
|
adb reverse tcp:8081 tcp:8081
|
||||||
adb forward tcp:8082 tcp:8082
|
|
||||||
|
|
||||||
react-native run-android
|
react-native run-android
|
||||||
|
|
|
@ -16,6 +16,24 @@ allprojects {
|
||||||
|
|
||||||
apply plugin: 'com.android.library'
|
apply plugin: 'com.android.library'
|
||||||
|
|
||||||
|
task forwardDebugPort(type: Exec) {
|
||||||
|
commandLine 'adb', 'forward', 'tcp:8082', 'tcp:8082'
|
||||||
|
ignoreExitValue true
|
||||||
|
doLast {
|
||||||
|
if (execResult.getExitValue() != 0) {
|
||||||
|
logger.error(
|
||||||
|
'===========================================================================\n' +
|
||||||
|
'WARNING: Failed to automatically forward port 8082.\n' +
|
||||||
|
'In order to use Realm in Chrome debugging mode, port 8082 must be forwarded\n' +
|
||||||
|
'from localhost to the device or emulator being used to run the application.\n' +
|
||||||
|
'You may need to add the appropriate flags to the command that failed:\n' +
|
||||||
|
' adb forward tcp:8082 tcp:8082\n' +
|
||||||
|
'===========================================================================\n'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 23
|
compileSdkVersion 23
|
||||||
buildToolsVersion "23.0.1"
|
buildToolsVersion "23.0.1"
|
||||||
|
@ -24,6 +42,10 @@ android {
|
||||||
minSdkVersion 16
|
minSdkVersion 16
|
||||||
targetSdkVersion 22
|
targetSdkVersion 22
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.withType(JavaCompile) {
|
||||||
|
compileTask -> compileTask.dependsOn forwardDebugPort
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
|
@ -11,7 +11,8 @@ cp ../../src/object-store/parser/queryTests.json node_modules/realm-tests/query-
|
||||||
|
|
||||||
echo "Reversing port for physical device"
|
echo "Reversing port for physical device"
|
||||||
adb reverse tcp:8081 tcp:8081
|
adb reverse tcp:8081 tcp:8081
|
||||||
adb forward tcp:8082 tcp:8082
|
|
||||||
react-native run-android
|
react-native run-android
|
||||||
|
|
||||||
echo "Unlocking device"
|
echo "Unlocking device"
|
||||||
adb shell input keyevent 82
|
adb shell input keyevent 82
|
||||||
|
|
Loading…
Reference in New Issue