Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all 28460 articles
Browse latest View live

Changing the color of a Text item from a FlatList onPress

$
0
0

I have a category list that is being displayed using a FlatList I tried changing the color of a single item OnPress so the user gets a feed back of what item he selected,but all the items in the FlatList change color.

How do I go along about implementing something like this so that the only selected item changes color and gets the original color back when another item is selected

Here is a sample of the code used :

import colors from "../config/colors";function Categories() {  return (<View style={styles.Categories}><FlatList        horizontal        showsHorizontalScrollIndicator={false}        style={{}}        data={category}        keyExtractor={(item) => item.id}        renderItem={({ item }) => {          return <Text style={styles.Text}>{item.title}</Text>;        }}      /></View>  );}

How to re-generate Android folder in React Native 0.62 (NOT EXPO)

$
0
0

I currently have an android build folder for my react native application. When I run the app, the build succeeds but the app "keeps stopping" and I can never launch the application. If anybody has a solution to this problem I would very much appreciate it. If not, I am hoping the regenerating the android folder would help so can somebody please guide me on how to regenerate the android folder or make my current build launch.

How can I set focus on the first TouchableHighlight component (or another one, given by ref for instance) inside the modal when modal is opened?

$
0
0

How can I set focus to the first (or any given) TouchableHighlight component inside the modal when it's opened?I'm using D-pad/kayboard/TV Remote

Let's use the fragment of the react-native documentation modal example:

<View style={{marginTop: 22}}><Modal    animationType="slide"    transparent={false}    visible={this.state.modalVisible}    onRequestClose={() => {      Alert.alert('Modal has been closed.');    }}><View style={{marginTop: 22}}><View><TouchableHighlight><Text>Button 1</Text></TouchableHighlight><TouchableHighlight><Text>Button 2</Text></TouchableHighlight><TouchableHighlight             onPress={() => {                this.setModalVisible(!this.state.modalVisible);             }}><Text>Hide Modal</Text></TouchableHighlight></View></View></Modal><TouchableHighlight     onPress={() => {       this.setModalVisible(true);     }}><Text>Show Modal</Text></TouchableHighlight></View>

Navigation with D-pad works, but when the modal is opened, the first TouchableHighlight (button 1) is not focused, focus remains on the "Show Modal" buttonOr, How can I set focus on the "Button 2" TouchableHighlight programatically?

TextInput for example has autoFocus, but TouchableHighlight no, if we are using only Touchable components inside a modal, I don;t know how to autoFocus them, or set implicitely it

Best Regards

Hello everyone, I need help, for react native launch icon

$
0
0

I am struggling to keep it uniform in my android mobile and android tablet. I am placing my android icon in assets/logo.png and then creating other icons for all devices using react-native set-icon --path --background --platform I don't know why the app icon on the tablet is without a corner radius whereas on mobile it is okay!

Tablet version

Mobile version

It will be great if anyone can help me??Thanks

Facing an error when running my android app on an emulator

$
0
0

Hi I'm just starting to learn how to code on android studio.

After running npm run android on my terminal, I've faced some errors which I could not solve.

The error message is as follows :

XXXX-MacBook-Pro:first-app XXXX$ npm run android

first-app@0.1.0 android /Users/XXXX/Desktop/React Native/first-app react-native run-android

Scanning folders for symlinks in /Users/XXXX/Desktop/React Native/first-app/node_modules (8ms) Starting JS server... Building and installing the app on the device (cd android && ./gradlew installDebug)...

FAILURE: Build failed with an exception.

What went wrong: Could not resolve all files for configuration':app:_internal_aapt2_binary'. Could not find com.android.tools.build:aapt2:3.2.0-4818971. Searched in the following locations: file:/Users/XXXX/Library/Android/sdk/extras/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom file:/Users/XXXX/Library/Android/sdk/extras/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-osx.jar file:/Users/XXXX/Library/Android/sdk/extras/google/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom file:/Users/XXXX/Library/Android/sdk/extras/google/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-osx.jar file:/Users/XXXX/Library/Android/sdk/extras/android/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom file:/Users/XXXX/Library/Android/sdk/extras/android/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-osx.jar file:/Users/XXXX/.m2/repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom file:/Users/XXXX/.m2/repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-osx.jarhttps://jcenter.bintray.com/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pomhttps://jcenter.bintray.com/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-osx.jar file:/Users/XXXX/Desktop/React Native/first-app/node_modules/react-native/android/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom file:/Users/XXXX/Desktop/React Native/first-app/node_modules/react-native/android/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-osx.jar Required by: project :app

BUILD FAILED in 3s 11 actionable tasks: 1 executed, 10 up-to-date Could not install the app on the device, read the error above for details.

I hope you guys can help me with it.

React native Keyboard pushes Bottomsheet out of screen / to top

$
0
0

I am struggling with this issue now for over three weeks.I am using the package osdnk/react-native-reanimated-bottom-sheet and I want to use textinputs inside the bottomsheet. The problem appears when opening the keyboard. The bottomsheet is pushed out of the screen.

There is already a github issue about this but everyone seems to get the problem solved. Except me? Also no one answers my questions there.

Steps I tried:

  • Android.xml: android:windowSoftInputMode="adjustPan"I am using expo and don't want to escape, so please don't provide solutions with the Android.xml file.
  • Replaced all flex:1 with height:100%
  • I tried different variations with wrapping the whole Bottomsheet / Content
  • Tried to create a 3rd snapping point with 100% and snap to this point as soon as an Inputfield is focused. However, this also results in the bottom sheet beeing out of the screen.
  • On IOS its working fine.

My code looks like the following: (simplyfied)

const renderInner = () => (<View><FormTextInput/></View>)return (<BottomSheet        snapPoints={['100%']}        renderContent={renderInner}        renderHeader={renderHeader}        initialSnap={0}    />)

How can I fix this weird behaviour? Please provide an example. Its enough to just use an example provided inside the git-repo, clear everything inside the bottom sheet and add a simple text-input.

enter image description here

SOLUTION

Your BottomSheet parent container should have the device screen height instead of height: 100%. There is no need for the android:windowSoftInputMode="adjustPan".

import BottomSheet from 'reanimated-bottom-sheet'import { View as Container, Dimensions } from 'react-native'const { height } = Dimensions.get('window')const Screen = () => (<Container style={{ height }}>    {/* Your screen content here */}<BottomSheet {...yourBottomSheetParams} /></Container>)export default Screen

react-native 0.59.10 crash Could not invoke FileReaderModule.readAsText

$
0
0

I'm unable to properly fix this as this is not reproducing but crashes the app randomly.There was no stack trace of my Js files, Please help!

Using:react-native: 0.59.10,rn-fetch-blob: 0.10.15

Production app crashes: here is stack trace:

Fatal Exception: java.lang.RuntimeException: Could not invoke FileReaderModule.readAsText   at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:383)   at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:158)   at com.facebook.react.bridge.queue.NativeRunnable.run(NativeRunnable.java)   at android.os.Handler.handleCallback(Handler.java:790)   at android.os.Handler.dispatchMessage(Handler.java:99)   at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)   at android.os.Looper.loop(Looper.java:164)   at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:232)   at java.lang.Thread.run(Thread.java:764)

react-native: google play store warning: "unoptimized APK""

$
0
0

I'm trying to lunch an Android app created with react native to the google play store.

I'm getting this warning:

enter image description here

To generate the APK I'm using the following commands:

react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res

Then from android folder:

gradlew assembleRelease -x bundleReleaseJsAndAssets

What can I do to optimze my APK then? Or is the warning message if false? The APK size is 38mb


Adb command similar to reverse?

$
0
0

I used to run adb reverse tcp:8081 tcp:8081 to connect/reconnect my devices to react native development server. but it's not supported on android 5. since adb reverse not supported on android <5x. i need it to do test app in old android versionalso i cant connect the device to react native server via wi-fi because it is an emulator

is there any similar command to do this?

Not receiving notifications when app is in the backgrouns on galaxy/samsung emulator/device

$
0
0

I am using Microsoft Notification Hub to send a notification on an Android device. I am using the React Native Azure Notification Hub npm library. But I am getting inconsistent behaviour in the notification. Sometimes I get the notification, but sometimes it doesn't arrive on my Samsung device when the app is in the foreground.

When my app is closed or in the background, I am not getting any notifications on the device. I am getting the same error on my Galaxy emulator. One of my friend tested on his emulated Nexus, he was getting the notification even when the app was closed. How do I resolve this intermittent notification issue?

Tab bar background color did not get changed

$
0
0

I am new in React-Native development. I am using TabNavigator from 'react-navigation' for tab bar in React-Native, everything is working fine excepts tab bar activeBackgroundColor and inactiveBackgroundColor did not get changed in android.Its showing blue color only like the image given below.

enter image description here

Code i am using is:

import React, { Component } from 'react';import { TabNavigator } from 'react-navigation';import { PixelRatio } from 'react-native';import { ColorScheme } from '../Resources/ColorScheme';import {Fonts} from '../Resources/Fonts';import TAB1 from '../Screens/TAB1'import TAB2 from '../Screens/TAB2' /** */ var FONT_SIZE = 8; if (PixelRatio.get() === 2) {  FONT_SIZE=10 }else if (PixelRatio.get() === 3) {    FONT_SIZE=12  }export default FavoritesScreenTabNavigator=TabNavigator({    TAB1:{screen:TAB1},    TAB2:{screen:TAB2}  },{      tabBarPosition:'top',      swipeEnabled:true,      animationEnabled:true,      tabBarOptions:{          activeTintColor:ColorScheme.tabBarSelectedTintColor,          inactiveTintColor:ColorScheme.tabBarUnSelectedTintColor,          activeBackgroundColor:'white',          inactiveBackgroundColor:'white',          labelStyle:{            fontSize: FONT_SIZE,            fontFamily: Fonts.QuicksandBold,            textAlign:'center'          },          indicatorStyle: {            borderBottomColor:ColorScheme.tabBarSelectedTintColor,            borderBottomWidth: 3,          }      },  })

Any help will be appreciated.

Thanks in advance.

ReactNative 0.59.x build fails on CircleCI with exit value 137

$
0
0

When building the app on CircleCI for v0.59.x it gives me the following error (It used to work fine till v0.57.8):

[12:45:19]: ▸ Note: Some input files use or override a deprecated API.[12:45:19]: ▸ Note: Recompile with -Xlint:deprecation for details.[12:45:19]: ▸> Task :react-native-svg:processReleaseJavaRes NO-SOURCE[12:45:19]: ▸> Task :react-native-svg:transformClassesAndResourcesWithPrepareIntermediateJarsForRelease[12:45:19]: ▸> Task :app:javaPreCompileQa[12:45:44]: ▸> Task :app:bundleQaJsAndAssets[12:45:44]: ▸ warning: the transform cache was reset.[12:46:00]: ▸ Loading dependency graph, done.[12:46:19]: ▸> Task :app:bundleQaJsAndAssets FAILED[12:46:19]: ▸ FAILURE: Build failed with an exception.[12:46:19]: ▸ * What went wrong:[12:46:19]: ▸ Execution failed for task ':app:bundleQaJsAndAssets'.[12:46:19]: ▸> Process 'command 'node'' finished with non-zero exit value 137

I figure this has something to do with memory or Gradle/Java options because the build works fine on my local machine (./gradlew assembleRelease)

Useful snippets from circle config:

jobs:  make-android:    ...    docker:      - image: circleci/android:api-28-node8-alpha    environment:      TERM: dumb      # JAVA_OPTS...      # GRADLE_OPTS...    steps:      - checkout:          path: *root_dir      - attach_workspace:          at: *root_dir      - run:          name: Build the app          no_output_timeout: 30m          command: bundle exec fastlane make

And fastlane make is

gradle(task: "clean")gradle(task: "assembleRelease")

I tried multiple JAVA_OPTS and GRADE_OPTS, including removing them (it used to work fine with no _OPTS with v0.57.8)

JAVA_OPTS: "-Xms512m -Xmx4096m"GRADLE_OPTS: -Xmx4096m -Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-Xms512m -Xmx4096m -XX:+HeapDumpOnOutOfMemoryError"
JAVA_OPTS: "-Xms512m -Xmx2048m"GRADLE_OPTS: -Xmx2048m -Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"

I also have this in android/app/build.gradle

dexOptions {    javaMaxHeapSize "2g"    preDexLibraries false}

Alarm for react native application (both android and ios)

$
0
0

I have being trying to build and alarm app in react native, so far I only find some solutions for android but not for ios. So can anyone please suggest some ways I can create an alarm in both android and ios platform using react native.

How to enable “Show on lock screen” and “Show pop-up when working in the background” in other permissions of Android applications?

$
0
0

I try to start my application from the background or when it is killed, with a locked / unlocked screen. But nothing happens without these two permissions. I enable them manually. But I would like them to be enable after installation, as in the applications of the WhatsApp, Teams, Telegram etc. I found similar questions and answers to them, none of them helped.

Android studio -> Generate signed bundle /apk error

$
0
0

When I want to package a React native project with APK in Android studio with Generate Signed Bundle / Apk, I get the following error ... What could be the reason?

Error:Internal error: (java.lang.ClassNotFoundException) com.google.wireless.android.sdk.stats.IntellijIndexingStats$Indexjava.lang.ClassNotFoundException: com.google.wireless.android.sdk.stats.IntellijIndexingStats$Index    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)    at com.intellij.util.indexing.counters.IndexCounters.<clinit>(IndexCounters.java:34)    at com.intellij.util.indexing.impl.MapReduceIndex.<init>(MapReduceIndex.java:85)    at org.jetbrains.jps.backwardRefs.index.CompilerReferenceIndex$CompilerMapReduceIndex.<init>(CompilerReferenceIndex.java:232)    at org.jetbrains.jps.backwardRefs.index.CompilerReferenceIndex.<init>(CompilerReferenceIndex.java:79)    at org.jetbrains.jps.backwardRefs.JavaCompilerBackwardReferenceIndex.<init>(JavaCompilerBackwardReferenceIndex.java:12)    at org.jetbrains.jps.backwardRefs.JavaBackwardReferenceIndexWriter.initialize(JavaBackwardReferenceIndexWriter.java:79)    at org.jetbrains.jps.incremental.java.JavaBuilder.buildStarted(JavaBuilder.java:148)    at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:363)    at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:178)    at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:139)    at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:302)    at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:135)    at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:228)    at org.jetbrains.jps.service.impl.SharedThreadPoolImpl.lambda$executeOnPooledThread$0(SharedThreadPoolImpl.java:42)    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)    at java.util.concurrent.FutureTask.run(FutureTask.java:266)    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)    at java.lang.Thread.run(Thread.java:748)

keyboard overplay input text in few android devices react native expo app

$
0
0

Hi I'm having an giftedchat input text overlap issue when keyboard is visible on few android devices to resolve this i tried to use keyboard-show/hide method but didn't worked also tried to using keyboard-spacer but nothing worked.This issue is not replicating on very devices currently its happening on One plus 6, samsung A-70 android version 9 Oxygen OS 9.0.9.The exact issue it not completely overlapping the input text let say only bottom border is getting under the keyboard.please find below the image to get exact idea of the issue.enter image description here

React Native upload image to AWS Server not working for Android

$
0
0

I was having some problem when trying to upload image from React Native to AWS Server. Here is my code:

async function uploadImageAsync(uri) {  console.log(uri);  let apiUrl = '...'  let uriParts = uri.split('.');  let fileType = uri[uri.length - 1];  let formData = new FormData();  formData.append('image', {    uri,    name: `image.jpg`,    filename: `image.jpg`,  });  let options = {    method: 'POST',    body: formData,    headers: {      Accept: 'application/json','Content-Type': 'multipart/form-data',    },  };  return fetch(apiUrl, options);}

The results that printed out at the console are:

file:///data/user/0/host.exp.exponent/cache/ExperienceData/%2540gh%252Ftp2/ImagePicker/37c89140-2172-4566-98a2-e7393ea72e89.jpgObject {"uploadResponse": undefined,}Object {"uploadResult": undefined,}Object {"e": [TypeError: Network request failed],}

What I did is I pick an image from image picker, then I will upload it to AWS server. If success, print out success message. If failed, print out those in the console above.

The strange thing is, it managed to upload on iOS but not Android. Any ideas why is it so?

Thanks!

Use fetch to post a blob in react-native

$
0
0

I'm trying to post a blob. It's definitely a blob. This isn't working in react-native though. I'm getting a red screen that says "PUT must have a request body". Well, I've put the blob in the request body.

createAttachment: function(url, blob) {  var settings = {    method: "PUT",    headers: {'Accept': 'image/jpeg','Content-Type': 'image/jpeg','If-Match': '*',    },    body: blob  };  return fetch(url, settings)}

How to convert image to pdf using flutter or react-native?

$
0
0

Are there any packages to convert capture images to pdf format using flutter or react-native

react-native Task :app:multiDexListDebug FAILED

$
0
0

I have installed react-native-firebase package using yarn. I've setup the code in the build.gradle, settings.gradle as well as the AndroidManifest as well. Added multiDexEnabled as true and also added the implementation line in the code, but it is still not working.

build.gradle (App Level)

apply plugin: "com.android.application"import com.android.build.OutputFile/** * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets * and bundleReleaseJsAndAssets). * These basically call `react-native bundle` with the correct arguments during the Android build * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the * bundle directly from the development server. Below you can see all the possible configurations * and their defaults. If you decide to add a configuration block, make sure to add it before the * `apply from: "../../node_modules/react-native/react.gradle"` line. * * project.ext.react = [ *   // the name of the generated asset file containing your JS bundle *   bundleAssetName: "index.android.bundle", * *   // the entry file for bundle generation. If none specified and *   // "index.android.js" exists, it will be used. Otherwise "index.js" is *   // default. Can be overridden with ENTRY_FILE environment variable. *   entryFile: "index.android.js", * *   // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format *   bundleCommand: "ram-bundle", * *   // whether to bundle JS and assets in debug mode *   bundleInDebug: false, * *   // whether to bundle JS and assets in release mode *   bundleInRelease: true, * *   // whether to bundle JS and assets in another build variant (if configured). *   // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants *   // The configuration property can be in the following formats *   //         'bundleIn${productFlavor}${buildType}' *   //         'bundleIn${buildType}' *   // bundleInFreeDebug: true, *   // bundleInPaidRelease: true, *   // bundleInBeta: true, * *   // whether to disable dev mode in custom build variants (by default only disabled in release) *   // for example: to disable dev mode in the staging build type (if configured) *   devDisabledInStaging: true, *   // The configuration property can be in the following formats *   //         'devDisabledIn${productFlavor}${buildType}' *   //         'devDisabledIn${buildType}' * *   // the root of your project, i.e. where "package.json" lives *   root: "../../", * *   // where to put the JS bundle asset in debug mode *   jsBundleDirDebug: "$buildDir/intermediates/assets/debug", * *   // where to put the JS bundle asset in release mode *   jsBundleDirRelease: "$buildDir/intermediates/assets/release", * *   // where to put drawable resources / React Native assets, e.g. the ones you use via *   // require('./image.png')), in debug mode *   resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", * *   // where to put drawable resources / React Native assets, e.g. the ones you use via *   // require('./image.png')), in release mode *   resourcesDirRelease: "$buildDir/intermediates/res/merged/release", * *   // by default the gradle tasks are skipped if none of the JS files or assets change; this means *   // that we don't look at files in android/ or ios/ to determine whether the tasks are up to *   // date; if you have any other folders that you want to ignore for performance reasons (gradle *   // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ *   // for example, you might want to remove it from here. *   inputExcludes: ["android/**", "ios/**"], * *   // override which node gets called and with what additional arguments *   nodeExecutableAndArgs: ["node"], * *   // supply additional arguments to the packager *   extraPackagerArgs: [] * ] */project.ext.react = [    enableHermes: false,  // clean and rebuild if changing]apply from: "../../node_modules/react-native/react.gradle"/** * Set this to true to create two separate APKs instead of one: *   - An APK that only works on ARM devices *   - An APK that only works on x86 devices * The advantage is the size of the APK is reduced by about 4MB. * Upload all the APKs to the Play Store and people will download * the correct one based on the CPU architecture of their device. */def enableSeparateBuildPerCPUArchitecture = false/** * Run Proguard to shrink the Java bytecode in release builds. */def enableProguardInReleaseBuilds = false/** * The preferred build flavor of JavaScriptCore. * * For example, to use the international variant, you can use: * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` * * The international variant includes ICU i18n library and necessary data * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that * give correct results when using with locales other than en-US.  Note that * this variant is about 6MiB larger per architecture than default. */def jscFlavor = 'org.webkit:android-jsc:+'/** * Whether to enable the Hermes VM. * * This should be set on project.ext.react and mirrored here.  If it is not set * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode * and the benefits of using Hermes will therefore be sharply reduced. */def enableHermes = project.ext.react.get("enableHermes", false);android {    compileSdkVersion rootProject.ext.compileSdkVersion    compileOptions {        sourceCompatibility JavaVersion.VERSION_1_8        targetCompatibility JavaVersion.VERSION_1_8    }    defaultConfig {        applicationId "com.safetravel_100"        minSdkVersion rootProject.ext.minSdkVersion        targetSdkVersion rootProject.ext.targetSdkVersion        versionCode 1        versionName "1.0"        multiDexEnabled true    }    splits {        abi {            reset()            enable enableSeparateBuildPerCPUArchitecture            universalApk false  // If true, also generate a universal APK            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"        }    }    signingConfigs {        debug {            storeFile file('debug.keystore')            storePassword 'android'            keyAlias 'androiddebugkey'            keyPassword 'android'        }    }    buildTypes {        debug {            signingConfig signingConfigs.debug        }        release {            // Caution! In production, you need to generate your own keystore file.            // see https://facebook.github.io/react-native/docs/signed-apk-android.            signingConfig signingConfigs.debug            minifyEnabled enableProguardInReleaseBuilds            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"        }    }    packagingOptions {        pickFirst "lib/armeabi-v7a/libc++_shared.so"        pickFirst "lib/arm64-v8a/libc++_shared.so"        pickFirst "lib/x86/libc++_shared.so"        pickFirst "lib/x86_64/libc++_shared.so"    }    // applicationVariants are e.g. debug, release    applicationVariants.all { variant ->        variant.outputs.each { output ->            // For each separate APK per architecture, set a unique version code as described here:            // https://developer.android.com/studio/build/configure-apk-splits.html            def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]            def abi = output.getFilter(OutputFile.ABI)            if (abi != null) {  // null for the universal-debug, universal-release variants                output.versionCodeOverride =                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode            }        }    }}dependencies {    implementation fileTree(dir: "libs", include: ["*.jar"])    //noinspection GradleDynamicVersion    implementation "com.facebook.react:react-native:+"  // From node_modules    implementation project(':react-native-geocoder')    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"    implementation 'androidx.multidex:multidex:2.0.0'    debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {      exclude group:'com.facebook.fbjni'    }    debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {        exclude group:'com.facebook.flipper'    }    debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {        exclude group:'com.facebook.flipper'    }    if (enableHermes) {        def hermesPath = "../../node_modules/hermes-engine/android/";        debugImplementation files(hermesPath +"hermes-debug.aar")        releaseImplementation files(hermesPath +"hermes-release.aar")    } else {        implementation jscFlavor    }}// Run this once to be able to run the application with BUCK// puts all compile dependencies into folder libs for BUCK to usetask copyDownloadableDepsToLibs(type: Copy) {    from configurations.compile    into 'libs'}apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)apply plugin: 'com.google.gms.google-services'

build.gradle (Project Level)

// Top-level build file where you can add configuration options common to all sub-projects/modules.buildscript {    ext {        buildToolsVersion = "28.0.3"        minSdkVersion = 16        compileSdkVersion = 28        targetSdkVersion = 28    }    repositories {        google()        jcenter()    }    dependencies {        classpath('com.android.tools.build:gradle:3.6.3')        classpath 'com.google.gms:google-services:4.2.0'   //added        // NOTE: Do not place your application dependencies here; they belong        // in the individual module build.gradle files    }}allprojects {    repositories {        mavenLocal()        maven {            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm            url("$rootDir/../node_modules/react-native/android")        }        maven {            // Android JSC is installed from npm            url("$rootDir/../node_modules/jsc-android/dist")        }        google()        jcenter()        maven { url 'https://www.jitpack.io' }    }}
Viewing all 28460 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>