Expo-ejected app crashes with java.net.ConnectException - java

I used Expo for my react-native app development.
Because of some packages not supported by Expo, I decided to eject my app from Expo.
I'm currently working on android studio, but stuck at this error.
java.lang.RuntimeException: Expo encountered a fatal error: java.net.ConnectException: Failed to connect to /192.168.0.6:19000
at host.exp.exponent.experience.BaseExperienceActivity$2.run(BaseExperienceActivity.java:206)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
If I navigate to BaseExperienceActivity.java:206,
...
// we don't ever want to show any Expo UI in a production standalone app
// so hard crash in this case
if (Constants.isStandaloneApp() && !isDebugModeEnabled()) {
throw new RuntimeException("Expo encountered a fatal error: " + errorMessage.developerErrorMessage());
}
...
I'm not using Expo start nor react-native run:android to run the app.
I'm running the app in Android Studio.
*Edited)
Below is my current build.gradle ./android/app
buildscript {
repositories {
google()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.31.0'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'devicefarm'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
android {
compileSdkVersion safeExtGet("compileSdkVersion", 28)
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId '######'
minSdkVersion safeExtGet("minSdkVersion", 21)
targetSdkVersion safeExtGet("targetSdkVersion", 28)
versionCode 6
versionName '1.8.0'
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
// Deprecated. Used by net.openid:appauth
manifestPlaceholders = [
'appAuthRedirectScheme': 'host.exp.exponent'
]
}
dexOptions {
javaMaxHeapSize System.getenv("DISABLE_DEX_MAX_HEAP") ? null : "8g"
}
signingConfigs {
debug {
storeFile file('../debug.keystore')
}
release {
storeFile file(System.getenv("ANDROID_KEYSTORE_PATH") ?: "release-key.jks")
storePassword System.getenv("ANDROID_KEYSTORE_PASSWORD")
keyAlias System.getenv("ANDROID_KEY_ALIAS")
keyPassword System.getenv("ANDROID_KEY_PASSWORD")
}
}
buildTypes {
debug {
debuggable false
// debuggable true (Original)
// ext.enableCrashlytics = false
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
consumerProguardFiles 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
lintOptions {
abortOnError false
}
packagingOptions {
pickFirst "**"
}
}
devicefarm {
projectName System.getenv("DEVICEFARM_PROJECT_NAME")
devicePool System.getenv("DEVICEFARM_DEVICE_POOL")
executionTimeoutMinutes 40
authentication {
accessKey System.getenv("AWS_ACCESS_KEY_ID")
secretKey System.getenv("AWS_SECRET_ACCESS_KEY")
}
}
configurations.all {
resolutionStrategy {
force 'org.webkit:android-jsc:r245459'
}
}
// WHEN_PREPARING_SHELL_REMOVE_FROM_HERE
apply from: 'expo.gradle'
// WHEN_PREPARING_SHELL_REMOVE_TO_HERE
apply from: "../../node_modules/react-native-unimodules/gradle.groovy"
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.multidex:multidex:2.0.0'
// Our dependencies
implementation 'androidx.appcompat:appcompat:1.1.0'
// (Recommended) Add the Google Analytics dependency.
implementation 'com.google.firebase:firebase-analytics:17.2.1'
// Add the Firebase Crashlytics dependency.
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
// Our dependencies from ExpoView
// DON'T ADD ANYTHING HERE THAT ISN'T IN EXPOVIEW. ONLY COPY THINGS FROM EXPOVIEW TO HERE.
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.facebook.android:facebook-android-sdk:5.0.1'
implementation('com.facebook.android:audience-network-sdk:5.1.1') {
exclude module: 'play-services-ads'
}
compileOnly 'org.glassfish:javax.annotation:3.1.1'
implementation 'com.jakewharton:butterknife:10.2.0'
implementation 'de.greenrobot:eventbus:2.4.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.google.android.gms:play-services-gcm:15.0.1'
implementation 'com.google.android.gms:play-services-analytics:16.0.1'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation "com.madgag.spongycastle:core:1.53.0.0"
implementation "com.madgag.spongycastle:prov:1.53.0.0"
debugImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
// debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.4-beta1'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
implementation 'com.facebook.device.yearclass:yearclass:2.1.0'
implementation 'commons-io:commons-io:1.4'
implementation 'me.leolin:ShortcutBadger:1.1.4#aar'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
implementation 'commons-codec:commons-codec:1.10'
implementation 'com.segment.analytics.android:analytics:4.3.0'
implementation 'com.google.zxing:core:3.3.3'
implementation 'net.openid:appauth:0.4.1'
implementation 'com.airbnb.android:lottie:2.5.6'
implementation('io.nlopez.smartlocation:library:3.2.11') {
transitive = false
}
implementation "androidx.exifinterface:exifinterface:1.0.0"
implementation 'com.squareup.okio:okio:1.9.0'
implementation 'com.facebook.soloader:soloader:0.6.0'
// expo-file-system
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.10.0'
// Testing
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
// We use a modified build of com.android.support.test:runner:1.0.1. Explanation in maven-test/README
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation "androidx.annotation:annotation:1.0.0"
androidTestImplementation 'com.google.code.findbugs:jsr305:3.0.0'
androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
androidTestImplementation 'com.azimolabs.conditionwatcher:conditionwatcher:0.2'
androidTestImplementation 'junit:junit:4.12'
androidTestImplementation 'org.mockito:mockito-core:1.10.19'
testImplementation 'org.robolectric:robolectric:3.8'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test:rules:1.2.0'
testImplementation 'androidx.test:runner:1.1.0'
testImplementation 'androidx.test:rules:1.2.0'
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:1.10.19'
implementation('host.exp.exponent:expoview:36.0.0#aar') {
transitive = true
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
exclude group: 'com.squareup.okhttp3', module: 'okhttp-urlconnection'
}
api 'org.webkit:android-jsc:r245459' // needs to be before react-native
api 'com.facebook.react:react-native:33.0.0'
addUnimodulesDependencies([
modulesPaths : [
'../../node_modules'
],
configuration: 'api',
target : 'react-native',
exclude : [
// You can exclude unneeded modules here, eg.
// 'unimodules-face-detector-interface',
// 'expo-face-detector'
// Adding a name here will also remove the package
// from auto-generated BasePackageList.java
]
])
}
// This has to be down here for some reason
apply plugin: 'com.google.gms.google-services'

I've got this problem too. I found that was occurred when property debuggable is true. Please check the build.gradle file in ./android/app/. Make sure that you pick the release version instead of debug and the property debuggable in release block is not exist or the value is false. Hope this would help you.

Related

Map Fragment do not show Map details Android

I'm trying to implement the maps fragment in my application, but when I test the apps on the simulator, the map details do not show up(unlike other devices/emulators).
I'm using the Pixel 3 API 29 emulator to test the app
(build.gradle)
plugins {
id 'com.android.application'
id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.G26.fitnessandnutritionbuddy"
minSdk 23
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.navigation:navigation-fragment:2.5.2'
implementation 'androidx.navigation:navigation-ui:2.5.2'
implementation 'com.google.android.gms:play-services-maps:18.1.0'
implementation 'androidx.annotation:annotation:1.4.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.android.volley:volley:1.2.1'
implementation 'com.google.android.gms:play-services-location:21.0.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
(Here is an image of the issue)
I expected to see the details of the maps (this happens in a few devices), but in general, most devices that are used for testing the app have the same issue.

I am facing problem for adding "implementation 'com.firebaseui:firebase-ui-database:8.0.1" in android studio(java)

I am facing problem for adding "implementation 'com.firebaseui:firebase-ui-database:8.0.1" in android studio(java).if I try to add this dependency then i face this problem,"error reading C:\Users\sourov ahmed.gradle\caches\modules-2\files-2.1\io.reactivex.rxjava3\rxjava\3.0.2\e652ec63717b1a92509abc8dc884fca0da3a974c\rxjava-3.0.2.jar; zip END header not found
"
My gradle code:
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.example.andromart"
minSdk 21
targetSdk 32`
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.firebase:firebase-database:20.0.5'
implementation 'io.github.pilgr:paperdb:2.7.2'
implementation 'de.hdodenhof:circleimageview:3.1.0'
implementation 'com.google.firebase:firebase-storage:20.0.1'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
implementation 'androidx.navigation:navigation-fragment:2.5.1'
implementation 'androidx.navigat[enter image description here][1]ion:navigation-ui:2.5.1'
implementation 'com.firebaseui:firebase-ui-database:8.0.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
Try deleting the corrupted cache. Invalidation caches and restart.

Execution failed for task ':openCVLibrary310:compileDebugAidl'

My build.gradle (app) looks like this. I am using opencV310 Library
android {
compileSdkVersion 29
defaultConfig {
applicationId "indidoc.pdf.converter"
minSdkVersion 16
targetSdkVersion 29
versionCode 1
versionName '1'
multiDexEnabled true
renderscriptTargetApi 23
renderscriptSupportModeEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath true
}
}
}
sourceSets { main { jni.srcDirs = ['src/main/jni', 'src/main/jni/'] } }
sourceSets.main.jni.srcDirs = []
sourceSets.main.jniLibs.srcDirs = ['src/main/libs', 'src/main/jniLibs']
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
dataBinding {
enabled = true
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
defaultConfig{
vectorDrawables.useSupportLibrary = true
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.12'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.github.bumptech.glide:glide:3.6.1'
implementation project(':openCVLibrary310')
implementation 'com.rmtheis:tess-two:6.1.1'
implementation 'com.github.mthli:Knife:v1.1'
implementation 'com.google.zxing:core:3.3.3'
implementation 'us.feras.mdv:markdownview:1.1.0'
implementation 'com.github.ctodobom:drag-select-recyclerview:0.3.4.ctodobom.sections'
implementation 'com.github.nostra13:Android-Universal-Image-Loader:v1.9.5'
implementation 'com.github.ctodobom:FabToolbar:3c5f0e0ff1b6d5089e20b7da7157a604075ae943'
implementation 'com.afollestad.material-dialogs:core:0.8.5.9'
implementation 'com.jakewharton.timber:timber:4.1.2'
implementation 'com.itextpdf:itextg:5.5.9'
implementation 'com.balysv:material-ripple:1.0.2'
implementation 'com.jakewharton:butterknife:10.2.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'it.chengdazhi.styleimageview:styleimageview:1.0.4'
implementation 'com.github.chrisbanes:PhotoView:2.3.0'
implementation 'com.facebook.android:audience-network-sdk:5.10.0'
implementation 'com.airbnb.android:lottie:3.0.7'
implementation 'com.itextpdf:itextg:5.5.10'
def room_version = "1.1.1"
implementation "android.arch.persistence.room:runtime:$room_version"
annotationProcessor "android.arch.persistence.room:compiler:$room_version"
implementation 'com.google.zxing:core:3.2.1'
implementation 'com.journeyapps:zxing-android-embedded:3.4.0'
implementation('com.github.thekhaeng:pushdown-anim-click:1.1.1') {
exclude group: 'com.android.support'
}
implementation 'com.github.ParkSangGwon:TedPicker:v1.0.10'
implementation 'com.android.support:multidex:2.0.1'
implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
implementation 'org.jsoup:jsoup:1.12.1'
}
The Error I am getting while building is
1 exception was raised by workers:
java.lang.RuntimeException: java.lang.RuntimeException: java.io.IOException: com.android.ide.common.process.ProcessException: Error while executing process C:\Users\Amit\AppData\Local\Android\Sdk\build-tools\29.0.2\aidl.exe with arguments {-pC:\Users\Amit\AppData\Local\Android\Sdk\platforms\android-29\framework.aidl
I am getting this error while debugging. Please put your suggestions where I am doing wrong. I have already me=ade some changes in build.gradle but it doesn't help.
Thank you.
You have to add openCV Library into your android studio project before implementing in build gradle. I think this link will help you understand. Integrating Your Android App with OpenCV Library

Google Cloud Speech to Text Error: java.lang.NoSuchMethodError: No virtual method build()Lcom/google/protobuf/GeneratedMessageLite;

I'm using Google Cloud Speech to text. For some reason, It works only the first time. After that, this error keeps appearing. I'm stuck.
java.lang.NoSuchMethodError: No virtual method
build()Lcom/google/protobuf/GeneratedMessageLite; in class
Lcom/google/cloud/speech/v1/RecognitionConfig$Builder; or its super
classes (declaration of
'com.google.cloud.speech.v1.RecognitionConfig$Builder'
build.gradle module app
apply plugin: 'com.android.application'
apply plugin: 'com.google.protobuf'
apply plugin: 'com.jakewharton.butterknife'
ext {
grpcVersion = '1.4.0' }
android {
compileSdkVersion 28
defaultConfig {
applicationId "app.android.com.colconvert"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.2'
} }
protobuf {
protoc {
artifact = 'com.google.protobuf:protoc:3.3.0'
}
plugins {
javalite {
artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0"
}
grpc {
artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}"
}
}
generateProtoTasks {
all().each { task ->
task.plugins {
javalite {}
grpc {
// Options added to --grpc_out
option 'lite'
}
}
}
} }
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.intellij:annotations:+#jar'
implementation 'com.jakewharton:butterknife:10.1.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
// gRPC
implementation "io.grpc:grpc-okhttp:$grpcVersion"
// implementation "io.grpc:grpc-protobuf-lite:$grpcVersion"
implementation "io.grpc:grpc-stub:$grpcVersion"
implementation 'javax.annotation:javax.annotation-api:1.2'
protobuf 'com.google.protobuf:protobuf-java:3.3.1'
implementation group: 'com.google.api.grpc', name: 'grpc-google-cloud-speech-v1', version: '0.1.13'
// OAuth2 for Google API
implementation('com.google.auth:google-auth-library-oauth2-http:0.7.0') {
exclude module: 'httpclient'
}
implementation 'com.android.support:multidex:1.0.0'
}
I think there is a problem with the version that you are using. I would recommend using the latest version like the following.
implementation group: 'com.google.api.grpc', name: 'grpc-google-cloud-speech-v1', version: '1.10.0'
Hope that helps!

Google places search box disappear in my android app, is it my code?

I have the following code in a map activity :
PlaceAutocompleteFragment autocompleteFragment = (PlaceAutocompleteFragment)
getFragmentManager().findFragmentById(R.id.autocomplete_fragment);
autocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener() {
#Override
public void onPlaceSelected(Place place) {
// TODO: Get info about the selected place.
destination = place.getName().toString();
}
#Override
public void onError(Status status) {
// TODO: Handle the error.
}
});
}
This is the XML fragment:
<fragment android:id="#+id/autocomplete_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:name="com.google.android.gms.location.places.ui.PlaceAutocompleteFragment"/>
Here is my app build.gradle file :
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.site.test"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-database:16.1.0'
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.firebase:firebase-storage:16.1.0'
implementation 'com.github.bumptech.glide:glide:4.0.0'
//implementation 'com.google.android.gms:play-services:12.0.1'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.firebase:geofire-android:2.1.1'
implementation 'com.android.support:cardview-v7:21.0.+'
implementation 'com.google.android.gms:play-services-places:16.0.0'
//below added for testing
//implementation 'com.google.android.libraries.places:1.0.0'
`enter code here`}
apply plugin: 'com.google.gms.google-services'
Once the map activity is activated, I see the fragment search box in it's correct placement. Once I click it, the search box pop-up briefly appears then disappears, effectively stopping me from entering a location.
I have enabled the Google Places API, and it is correctly placed in my android manifest file.
This is what the logcat shows :
2019-03-04 00:58:55.090 6506-6506/com.site.test E/SchedPolicy: set_timerslack_ns write failed: Operation not permitted
Seems to be an issue in Places, try this
https://stackoverflow.com/a/55073542/11551260

Categories