zoukankan      html  css  js  c++  java
  • @react-native-community/async-storage在Android上的手动link问题

    PS C:UserslinjinDesktopRN_APP> react-native link @react-native-community/async-storage
    error Something went wrong while linking. Error: Expected "/* Begin ", "/* End ", """, or [A-Za-z0-9_.] but "<" found.
    Please file an issue here: https://github.com/react-native-community/react-native-cli/issues
    error Expected "/* Begin ", "/* End ", """, or [A-Za-z0-9_.] but "<" found.
    

    解决方案

    1.在项目结构android/settings.gradle中添加如下代码:
    rootProject.name = 'MyApp'
    
    include ':app'
    
    + include ':@react-native-community_async-storage'
    + project(':@react-native-community_async-storage').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/async-storage/android')
    
    2.在项目结构android/app/build.gradle添加如下dependencies:
    dependencies {
      ...
    + implementation project(':@react-native-community_async-storage')
    }
    
    3.在MainApplication.java添加如下代码:
    package com.myapp;
    
    + import com.reactnativecommunity.asyncstorage.AsyncStoragePackage;
    
    ...
    
    @Override
    protected List<ReactPackage> getPackages() {
        return Arrays.<ReactPackage>asList(
            new MainReactPackage(),
    +       new AsyncStoragePackage()    
        );
    }
    
  • 相关阅读:
    Leetcode题目:Remove Duplicates from Sorted List
    Leetcode题目:Lowest Common Ancestor of a Binary Search Tree
    Leetcode题目:Ugly Number
    Leetcode题目:Remove Linked List Elements
    Leetcode题目:Count and Say
    6-3 事务
    6-1 视图
    5-2 pymysql模块
    5-1 图形工具Navicat
    4-3 多表查询
  • 原文地址:https://www.cnblogs.com/fe-linjin/p/10636552.html
Copyright © 2011-2022 走看看