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

Execution failed for task ':app:transformDexArchiveWithDexMergerForDebug'. - React Native

$
0
0

I have App written with react-native and it's work very fine previously

but when I install RN async-storage

I Don't change anything in native android code

I got an error when running the app

I'm trying to remove it and rebuild my app BUT the issue still I don't know why!!

I'm tried to run these command

rm -rf node_modules 
npm install

then

cd android && gradlew clean

and it's building successfully without any error

but after run react-native run-android

I got

  • What went wrong: Execution failed for task ':app:transformDexArchiveWithDexMergerForDebug'.

    com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: The number of method references in a .dex file cannot exceed 64K. Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html

SO how can I solve it? please it's important "I'm in deadline" :V


Is there a way to work with microsoft LUIS with React Native?

$
0
0

Is there a way to work with Microsoft LUIS with React Native ? I want to record the voice using microphone, store it in a wave file and send that wave file to LUIS to recognize the intent ? Any suggestions,Any examples , Any HELP?

metro-config node_modules not found in react-native project

$
0
0

I am serving "react-native start" command in my project and it gives me below error.

Invalid regular expression: /(.\__fixtures__\.|node_modules[\]react[\]dist[\].|website\node_modules\.|heapCapture\bundle.js|.\__tests__\.)$/: Unterminated character class

I have found above problem solution here.

But the problem is when i am trying to navigate to "node_modules\metro-config\src\defaults\blacklist.js" this path there is no such folder named "metro-config".

I did remove the node_modules and re-install them again but the problem is still same.

React Native onBeforeSnapToItem combined with onPress

$
0
0

So this is a screen where you slide left to go forward and slide right to go back. there is also a button at the bottom, when clicked it skip all the slide and it goes to the main screen. onPress={() => this.props.navigation.navigate('Mainscreen')}

the issue here is that I would like to change this button so instead of skipping all the slide it just takes you to the next side, basically it will act the same as sliding left. and honestly I still didn't grasp how onBeforeSnapToItem works

render() {
    const width = Dimensions.get('window').width * 0.9

    return (
      <View style={loginStyles.containerExpand}>
        <View style={loginStyles.carouselOuter}>
          <ProgressDots current={this.state.currentSlide} total={SLIDE_COUNT} />
          <Carousel
            data={this.slides}
            renderItem={this.renderItem}
            onBeforeSnapToItem={this.handleSlideChange}
            itemWidth={width}
            sliderWidth={width}
          />
        </View>
        <View style={loginStyles.buttonContainer}>
          <TouchableHighlight
            style={loginStyles.button}
            onPress={() => this.props.navigation.navigate('Mainscreen')}
            underlayColor={Colors.buttonSecondaryBkgdActive}
          >
            <Text style={loginStyles.buttonText}>{this.buttonText}</Text>
          </TouchableHighlight>
        </View>
      </View>
    )
  }
}

and this handleSlideChange function

  handleSlideChange = (currentSlide) => {
    this.setState({currentSlide})
  }

react expo [Unhandled promise rejection: Error: Tried to use permissions API but the host Activity doesn't implement PermissionAwareActivity.]

$
0
0

I followed the tutorial for react native camera. I did all the changes also implemented the PermissionAwareActivity for MainActivity, but still give me [Unhandled promise rejection: Error: Tried to use permissions API but the host Activity doesn't implement PermissionAwareActivity.]

MainActivity.java

import com.facebook.react.ReactActivity;
import com.facebook.react.ReactActivityDelegate;
import com.facebook.react.ReactRootView;
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;

import android.os.Bundle;
import android.annotation.TargetApi;
import android.os.Build;
import android.support.annotation.NonNull;

import com.facebook.react.modules.core.PermissionAwareActivity;
import com.facebook.react.modules.core.PermissionListener;

import javax.annotation.Nullable;

public class MainActivity extends ReactActivity implements PermissionAwareActivity {

    @Nullable
    private PermissionListener permissionListener;

    /**
     * Returns the name of the main component registered from JavaScript.
     * This is used to schedule rendering of the component.
     */
    @Override
    protected String getMainComponentName() {
        return "AppCamera";
    }

    @Override
    protected ReactActivityDelegate createReactActivityDelegate() {
        return new ReactActivityDelegate(this, getMainComponentName()) {
            @Override
            protected ReactRootView createRootView() {
                return new RNGestureHandlerEnabledRootView(MainActivity.this);
            }
        };
    }

    @TargetApi(Build.VERSION_CODES.M)
    public void requestPermissions(String[] permissions, int requestCode, PermissionListener listener) {
        permissionListener = listener;
        requestPermissions(permissions, requestCode);
    }

    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
        if (permissionListener != null) {
            permissionListener.onRequestPermissionsResult(requestCode, permissions, grantResults);
        }
    }
}

expo generated apk not saving given permissions

$
0
0

I have an expo app that was working just fine in both iOS and Android, but yesterday I built again and installed the app in Android using the internal test tracks and now the app asks for the needed permissions, I give them but the app acts as is the permission is not given.

I tried reseting all permissions in the app manager, also rebuilt and publish again with expo still nothing.

This is the code I'm using to ask for permissions:

askPermission = async (requestedPermission) => {
        // Ask user for permission...
        const { status } = await Permissions.askAsync(requestedPermission);
        return status;
    }

    async uploadProfilePicture(){
        try{

            const status  = await this.askPermission(Permissions.CAMERA_ROLL);           
            if (status !== 'granted') {                
                    Alert.alert(i18n.t('permissions.camera_roll'));
            }else{
                let result = await ImagePicker.launchImageLibraryAsync();
            ...

here is my app.json:

{
  "expo": {
    "name": "eazi",
    "slug": "eazi",
    "privacy": "public",
    "sdkVersion": "35.0.0",
    "platforms": [
      "ios",
      "android"
    ],
    "version": "1.0.0",
    "scheme": "eazi",
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "primaryColor": "#FFFFFF",
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "ios": {
      "buildNumber": "5",
      "supportsTablet": true,
      "bundleIdentifier": "com.eaziapp.ios",
      "infoPlist": {
        "NSCameraUsageDescription": "This app uses the camera to allow taking pictures to attach to requests."
      }
    },
    "android": {
      "versionCode": 7,
      "package": "com.eaziapp.android",
      "permissions": [
        "ACCESS_COARSE_LOCATION",
        "ACCESS_FINE_LOCATION",
        "CAMERA",
        "MANAGE_DOCUMENTS",
        "READ_EXTERNAL_STORAGE",
        "READ_PHONE_STATE"
      ]
    },
    "description": "",
    "hooks": {
      "postPublish": [
        {
          "file": "sentry-expo/upload-sourcemaps",
          "config": {
            "organization": "obscurred",
            "project": "obscurred",
            "authToken": "obscurred"
          }
        }
      ]
    }


  }
}

Icons from react-native-vector-icons onpress needs to click twice to work

$
0
0

I use react-native-vector-icons.

  1. Click the input
  2. Keyboard goes up
  3. When pressing the icon, icon doesn't trigger, the keyboard will go down first rather than the onpress method icon triggers while having the keyboard is on

Expected Result would like a live chat, while keyboard is up submit icon will always trigger.

I tried to enwrap it in scrollview with keyboardshouldpersisttaps and it doesn't work.

<KeyboardAvoidingView
        behavior={Platform.OS === 'ios' ? 'padding' : null}
        style={{ flex: 1 }}
        keyboardVerticalOffset={64}
      >
        <View style={styles.slide} key={i}>
          <TouchableHighlight
            style={styles.video}
            onPress={this.handleDoubleTap}
            onLongPress={this.handlePlayAndPause}
          >
            <ViewportAwareVideo
              key={i}
              source={{ uri: firstVideoUri }}
              shouldPlay={this.state.shouldPlay}
              isLooping
              preTriggerRatio={-0.4} // default is 0
              retainOnceInViewport={false} // default is false
              style={styles.video}
              onPlaybackStatusUpdate={this._onPlaybackStatusUpdate}
              progressUpdateIntervalMillis={1000}
              resizeMode='contain'
              innerRef={ref => (this._videoRef = ref)}
              onViewportEnter={() => {
                this.setState({ shouldPlay: true });
              }}
              onViewportLeave={() => {
                this.setState({ shouldPlay: false });
              }}
            />
          </TouchableHighlight>

          {this.state.shouldPlay ? null : (
            <TouchableHighlight
              onPress={this.handlePlayAndPause}
              style={styles.pauseBtn}
            >
              <IconComponent name='play-circle' size={50} color='black' />
            </TouchableHighlight>
          )}

          <CopilotStep
            name='swipeUp'
            text='Swipe up to view next video'
            order={5}
          >
            <WalkthroughableView style={styles.topSection}>
              <Text style={styles.imageHeadingText}>{product.name}</Text>
              {product.short_description === '' ? null : (
                <HTML
                  html={product.short_description}
                  imagesMaxWidth={Dimensions.get('window').width}
                  containerStyle={styles.imageDescText}
                  baseFontStyle={styles.htmlStyle}
                />
              )}
              <CopilotStep
                name='swipeRight'
                text='Swipe right to view product details'
                order={6}
              >
                <WalkthroughableView
                  style={{
                    flexDirection: 'row',
                    flexWrap: 'wrap',
                    paddingHorizontal: 20,
                    paddingVertical: 5
                  }}
                >
                  {product.tags.map((value, index) => {
                    return (
                      <Text key={index} style={styles.tagText}>
                        {value.name.charAt(0) === '#'
                          ? value.name
                          : '#' + value.name}
                      </Text>
                    );
                  })}
                </WalkthroughableView>
              </CopilotStep>
              {product.total_sales > 0 ? (
                <View
                  style={{
                    flexDirection: 'row',
                    flexWrap: 'wrap',
                    paddingHorizontal: 20,
                    paddingVertical: 5
                  }}
                >
                  <Text style={styles.totalSales}>
                    {product.total_sales +
                      (product.total_sales > 100
                        ? '+ bought'
                        : ' bought in the last 24 hours')}
                  </Text>
                </View>
              ) : null}
            </WalkthroughableView>
          </CopilotStep>

          <View style={styles.bottomSection}>
            <View style={{ flex: 1, justifyContent: 'flex-end', height: 30 }}>
              {this.state.messages.map((message, index) => (
                <React.Fragment key={index}>
                  <View
                    key={index}
                    style={{
                      flexDirection: 'row',
                      alignItems: 'center',
                      marginHorizontal: 5,
                      marginVertical: 5,
                      paddingLeft: 10,
                      height: 20
                    }}
                  >
                    <Image
                      style={{ width: 20, height: 20, borderRadius: 20 / 2 }}
                      source={{ uri: 'https://picsum.photos/20/20' }}
                    />
                    <Text
                      style={{
                        fontFamily: Constants.fontHeader,
                        marginHorizontal: 5,
                        color: '#007AFF'
                      }}
                    >
                      {message.user.name}
                    </Text>
                    <Text
                      style={{
                        fontFamily: Constants.fontHeader,
                        marginHorizontal: 5,
                        color: 'white'
                      }}
                    >
                      {message.text}
                    </Text>
                  </View>
                </React.Fragment>
              ))}
            </View>
            <CopilotStep
              name='chatOnFeed'
              text='Click here to chat on video feed'
              order={7}
            >
              <WalkthroughableTextInput
                style={{
                  // position: 'absolute',
                  // bottom: 0,
                  // left: 0,
                  fontFamily: Constants.fontFamily,
                  marginBottom: 110,
                  marginHorizontal: 5,
                  marginVertical: 5,
                  paddingRight: 35,
                  paddingLeft: 20,
                  height: 35,
                  width: width - 60,
                  backgroundColor: 'white',
                  borderRadius: 25
                }}
                onChangeText={messageText => this.setState({ messageText })}
                value={this.state.messageText}
                placeholder='Share your thoughts'
                placeholderTextColor='#9B9B9B'
              />
            </CopilotStep>

            <IconComponent
              style={{ position: 'absolute', bottom: 115, right: 10 }}
              name='arrow-right'
              size={25}
              color='black'
              onPress={product => this.sendMessage(product)}
            />
          </View>

          <View style={styles.iconBar}>
            <CopilotStep
              name='productDetail'
              text='Click here to got to product details'
              order={8}
            >
              <WalkthroughableText>
                <IconComponent
                  style={styles.iconBarIcon}
                  name='shopping-cart'
                  size={iconSize}
                  color='white'
                  onPress={() => {
                    this.props.onViewProductScreen({ product });
                    this.setState({ shouldPlay: false });
                  }}
                />
              </WalkthroughableText>
            </CopilotStep>
            <Text style={styles.iconBarText}>Shop</Text>
            <CopilotStep
              name='like'
              text='Click here to like this product'
              order={9}
            >
              <WalkthroughableText>
                <Entypo
                  style={styles.iconBarIcon}
                  name='heart'
                  size={30}
                  color={this.state.isInWishList ? 'red' : 'white'}
                  onPress={() => {
                    this.state.isInWishList
                      ? this.props.removeWishListItem(product)
                      : this.props.addWishListItem(product);

                    this.setState(prevState => ({
                      isInWishList: !prevState.isInWishList
                    }));
                  }}
                />
              </WalkthroughableText>
            </CopilotStep>
            <Text style={styles.iconBarText}>Like</Text>
            <CopilotStep
              name='share'
              text='Click here to share this product'
              order={10}
            >
              <WalkthroughableText>
                <IconComponent
                  style={styles.iconBarIcon}
                  name='share'
                  size={iconSize}
                  color='white'
                  onPress={this.onShare}
                />
              </WalkthroughableText>
            </CopilotStep>
            <Text style={styles.iconBarText}>Share</Text>
            <CopilotStep
              name='fullChat'
              text='Click here to view full chat'
              order={11}
            >
              <WalkthroughableText>
                <IconComponent
                  style={[styles.iconBarIcon, { paddingTop: 4 }]}
                  name='message-circle'
                  size={iconSize}
                  color='white'
                  onPress={product => this.sendChat(product)}
                />
              </WalkthroughableText>
            </CopilotStep>
          </View>
        </View>
      </KeyboardAvoidingView>
    );

You can see my problem is on IconComponent after the WalkthroughableTextInput

React Native Task :react-native-maps:compileDebugJavaWithJavac FAILED

$
0
0

I installed react-native-maps but when i run react-native run-android i got this error:

C:\Users\Emre\example\node_modules\react-native-maps\lib\android\src\main\java\com\airbnb\android\react\maps\AirMapView.java:12: error: package androidx.core.view does not exist
import androidx.core.view.GestureDetectorCompat;
                         ^
C:\Users\Emre\example\node_modules\react-native-maps\lib\android\src\main\java\com\airbnb\android\react\maps\AirMapView.java:13: error: package androidx.core.view does not exist
import androidx.core.view.MotionEventCompat;
                         ^
C:\Users\Emre\example\node_modules\react-native-maps\lib\android\src\main\java\com\airbnb\android\react\maps\AirMapView.java:22: error: package androidx.core.content.PermissionChecker does not exist
import androidx.core.content.PermissionChecker.checkSelfPermission;
                                              ^
C:\Users\Emre\example\node_modules\react-native-maps\lib\android\src\main\java\com\airbnb\android\react\maps\AirMapView.java:74: error: package androidx.core.content does not exist
import static androidx.core.content.PermissionChecker.checkSelfPermission;
                                   ^
C:\Users\Emre\example\node_modules\react-native-maps\lib\android\src\main\java\com\airbnb\android\react\maps\AirMapView.java:74: error: static import only from classes and interfaces
import static androidx.core.content.PermissionChecker.checkSelfPermission;
^
C:\Users\Emre\example\node_modules\react-native-maps\lib\android\src\main\java\com\airbnb\android\react\maps\AirMapView.java:109: error: cannot find symbol
  private final GestureDetectorCompat gestureDetector;
                ^
  symbol:   class GestureDetectorCompat
  location: class AirMapView
C:\Users\Emre\example\node_modules\react-native-maps\lib\android\src\main\java\com\airbnb\android\react\maps\AirMapView.java:161: error: cannot find symbol
    gestureDetector = new GestureDetectorCompat(reactContext, new GestureDetector.SimpleOnGestureListener() {
                          ^
  symbol:   class GestureDetectorCompat
  location: class AirMapView
C:\Users\Emre\example\node_modules\react-native-maps\lib\android\src\main\java\com\airbnb\android\react\maps\AirMapView.java:422: error: cannot find symbol
    return checkSelfPermission(getContext(), PERMISSIONS[0]) == PackageManager.PERMISSION_GRANTED
           ^
  symbol:   method checkSelfPermission(Context,String)
  location: class AirMapView
C:\Users\Emre\example\node_modules\react-native-maps\lib\android\src\main\java\com\airbnb\android\react\maps\AirMapView.java:423: error: cannot find symbol
        || checkSelfPermission(getContext(), PERMISSIONS[1]) == PackageManager.PERMISSION_GRANTED;
           ^
  symbol:   method checkSelfPermission(Context,String)
  location: class AirMapView
C:\Users\Emre\example\node_modules\react-native-maps\lib\android\src\main\java\com\airbnb\android\react\maps\AirMapView.java:956: error: cannot find symbol
    int action = MotionEventCompat.getActionMasked(ev);
                 ^
  symbol:   variable MotionEventCompat
  location: class AirMapView
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
10 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-maps:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings

BU¦LD FAILED in 3s
19 actionable tasks: 2 executed, 17 up-to-date
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: gradlew.bat app:installDebug. Run CLI with --verbose flag for more details.

react-native link react-native-maps works for only ios. I linked it manually but it is not working.

"react-native": "0.59.9", "react-native-maps": "0.26.1",

What do i need to do to solve it?


Is there a way to record audio with React native and store it as a wave file?

$
0
0

when the user clicks the button, The app should start listening the audio and stop the recording when the user is silent(say for 20 seconds after silence) , now store that audio file in a wave format(eg: test.wav) in react native ?

React native: Build one apk for all android devices

$
0
0

I make a android app with react native and after build aab and published in google play, now i want download apk to upload to othet store, but google play install special apk for ever android phone, how cat in download full apk to upload in other store for all android phones?

The library com.google.firebase:firebase-iid is being requested by various other libraries at [[17.0.0,17.0.0]], but resolves to 16.2.0

$
0
0

I started to get this error today, yesterday everything worked fine, there was no changes in gradle or firebase version

The library com.google.firebase:firebase-iid is being requested by various other libraries at [[17.0.0,17.0.0]], but resolves to 16.2.0. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.

I saw that yesterday was update in google-services plugin, probably that is causing the problem.

How to fix this problem?

BackAndroid/BackHandler Event Listeners are not Triggered when set in a Modal's Child Component

$
0
0

I am unable to set event listeners using the react-native BackHandler in a component that is placed inside a modal. I suspect that this happens because the modal is listening to the method that is passed on the onRequestClose prop.

Well, I am not sure if this is a bug or a feature request but I would suggest that you allowed us to pass a certain value (e.g null) to the onRequestClose prop as a way of flagging that there might be BackHandler event listeners being set in the Modal's child components, and that these listeners have priority (i.e override the onRequestClose of the Modal).

Environment

Environment:

  • OS: macOS High Sierra 10.13.3
  • Node: 9.2.0
  • Yarn: 0.24.6
  • npm: 5.6.0
  • Watchman: 4.7.0
  • Xcode: Xcode 9.2 Build version 9C40b
  • Android Studio: 3.0 AI-171.4408382

Packages: (wanted => installed)

  • react: 16.2.0 => 16.2.0
  • react-native: 0.53.0

    => 0.53.0

Steps to Reproduce

Below there is the instructions inside the child component:

class ChildComponent extends Component {
    componentDidMount () {
        BackHandler.addEventListener('hardwareBackPress', this._onBackPress)
    }

    componentWillUnmount () {
        BackHandler.removeEventListener('hardwareBackPress', this._onBackPress)
    }

    _onBackPress = () => {
        console.log('Event was triggered')

        return true
    }

    render () {
        return (
            <Text>{'Some Text'}</Text>
        )
    }
}

export default ChildComponent

The component that has the Modal (parent) has the following instructions:

class ParentComponentWithModal extends Component {
    constructor (props) {
        super(props)
        this.state = {
            modalVisible: true
        }
    }

    render () {
        const { modalVisible } = this.state
        return (
            <View>
                <Modal
                    visible={modalVisible}
                    onRequestClose={() => console.log('onRequestClose')}
            >
                <ChildComponent />
            </Modal>
          </View>
        )
    }
}

export default ParentComponentWithModal

Expected Behavior

The _onBackPress method added to hardwareBackPressed listener should be executed when the back button is pressed.

Actual Behavior

When the back button is pressed, the function defined on the onRequestClose prop is triggered. Even if no function is defined on the onRequestClose prop, the methods attached to the event listeners defined in the modal's children are not executed.

React Native - I cannot send any FormData with fetch

$
0
0

I was trying to send an image and some description from my React Native app to a Node Rest Api but it never reaches the api. This is my code:

let formData = new FormData();

formData.append("imageFile", {
    uri: image.uri,
    type: "image/jpeg",
    name: filename,
});
/*
    image.uri is similar to this: "file:///data/user/0/host.exp.exponent/cache/ExperienceData
    /%2540anonymous%252FAppTest_v1-7f36da10-9f18-4a65-97f6-55d9c75f3998/ImagePicker/
    e54acf1b-5391-4db3-87e5-a8765decf3c5.jpg",
    and filename: "e54acf1b-5391-4db3-87e5-a8765decf3c5.jpg"
*/

formData.append("data", {fromApp: "true", userId: "testID123"});

//console.log(formData);
try{
    const response = await fetch(
        serverIp + "/manageFiles/almacenImagenes",{
            method: "POST",
            //headers: {'Content-Type': 'multipart/form-data'}, //doesn't work with or without this
            body: formData
        }
    );
    console.log("RESPONSE:",response);
    const resData = await response.json();
    console.log("resDATA:",resData);

}catch(err){
    console.log("ERROR:", err);
}

When I send an image, fetch throws the error: [TypeError: Network request failed]. And no request is received by my node server. I've tried sending a FormData only with strings, something like:

let formData = new FormData();
formData.append("something","abc123");

That is sent, but the body of the request is empty.

I also prove this:

const response = await fetch(serverIp + "/login", {
    method: "POST",
    headers: {
        "Content-Type": "application/json"
    },
    body: JSON.stringify({
        fromApp: true,
        email,
        password
    })
});

And it works correctly, but with that I cannot send an image.

I'm using Expo version 35.0.0 and React Native version 0.59.8, and I'm testing the app in a real Android device. Please someone can tell what I'm doing wrong, I've been looking for an answer everywhere but I haven't found anything that works for me.

Update App React Native 32 Bits to 64 Bits

$
0
0

I have an outdated 32-bit application to react native, now I want to update that application with the latest versions, my question is, I have to work on that application or I can create a new one with the same package name and the same keystore, in such a way that it helps me to update the previous one, I hope you have explained, thanks in advance.

error: package com.android.annotations does not exist

$
0
0

I have the following class

import com.android.annotations.NonNullByDefault;

@NonNullByDefault
public final class Log {
    ...
}

and here is my build.gradle file (some parts omitted)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion '24.0.1'

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 2
        versionName "0.2"
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

}

dependencies {    
    compile 'com.android.support:appcompat-v7:25.0.0'
    compile 'com.android.support:support-annotations:25.0.0'
    compile 'com.android.support:design:25.0.0'
}

In Android Studio there is no warning raised for my class

enter image description here

However when I try to build and run my app I get this error from gradle

Information:Gradle tasks [:app:clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:assembleDebug]
Warning:[options] bootstrap class path not set in conjunction with -source 1.7
/home/puter/git-repos/TaskManager3/app/src/main/java/com/treemetrics/taskmanager3/util/Log.java
Error:(3, 31) error: package com.android.annotations does not exist
Error:(7, 2) error: cannot find symbol class NonNullByDefault
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
Information:BUILD FAILED
Information:Total time: 21.021 secs
Information:3 errors
Information:1 warning
Information:See complete output in console

How to upload react-native 0.54.3 android Apk to play store? it is throwing google play 64-bit requirements error

$
0
0

we had developed react-native 0.54.3 app and uploaded to playstore. now we are going to update android app now. it is throwing. enter image description here

can we update react-native 0.54.3 apk to playstore? is it possible?

Didn't find class "com.facebook.react.devsupport.DevSupportManagerImpl" on path: DexPathList

$
0
0

I tried to enable proguard on my react native (v61.2) application by setting on app level: build.gradle

minifyEnabled true

proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

But i get this error:

Didn't find class "com.facebook.react.devsupport.DevSupportManagerImpl" on path: DexPathList

====

I already have the dependency

implementation 'com.android.support:multidex:1.0.3'

And also have this buildscript dependency already

classpath 'com.android.tools.build:gradle:3.5.0'

Any idea where to look? Stack Trace:

Caused by: java.lang.ClassNotFoundException: com.facebook.react.devsupport.DevSupportManagerImpl
        at java.lang.Class.classForName(Native Method)
        at java.lang.Class.forName(Class.java:453)
        at java.lang.Class.forName(Class.java:378)
        at com.facebook.react.devsupport.b.a(DevSupportManagerFactory.java:67)

React Native MQTT.js does not work on Android 9+

$
0
0

I am building an Android app using React Native 0.61 (CLI) and use common MQTT.js packages here: https://www.npmjs.com/package/mqtt(v.3.0.0)

This is my build.gradle

buildToolsVersion = "28.0.3"
minSdkVersion = 25
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"

I use WebSocket protocol to connect to my own mqtt broker.

In debug mode, everything works perfectly on any phone. But weird that when I release APK by command (gradlew assembleRelease (signed)), it can not connect to the broker on Android 9+ (both emulator) (Android 8 work well)

It seems there was a problem when compiling to native code.

XMLHttpRequest error in ReactNative Debug mode

$
0
0

I delete my android emulator and create a new one after this when i build my react native project and active debug mode this error appears on emulator but i dont have any problems with Previous emulator :

Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'http://localhost:8083/create_session'.

and this on browser's console :

Must first create RPC session with a valid host

what should i do?

Does React Native compile JavaScript into Java for Android?

$
0
0

When I develop hybrid apps with React Native. Does the JavaScript code I write transform into Java-Code or Java-Bytecode for the Dalvik/ART Runtime when I create an Android-App from my React Native code? Or are just the UI components compiled into native UI components? Or does a library like the Fetch API compile the JavaScript code into Java-Code or Java-Bytecode?

Viewing all 28476 articles
Browse latest View live


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