反应本地构建错误(任务':app:transformClassesWithMultidexlistForDebug'的执行失败)

时间:2020-08-12 19:05:47

标签: android react-native build build.gradle package.json

我正在尝试在我的本机应用程序中使用Paypal付款网关。我最初使用的是react-native-paypal-wrapper,但是后来当我试图让我得到这个错误时。请帮助我解决此错误enter image description here

供您参考,我提供了build.gradle和settings.gradle。

settings.gradle

rootProject.name = 'moneymall'
include ':react-native-paypal-wrapper'
project(':react-native-paypal-wrapper').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-paypal-wrapper/android')

apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'

build.gradle

buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:3.4.2")

        // 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://jitpack.io' }
    }
}

MainApplication.java

package com.moneymall;

import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.taessina.paypal.RNPaypalWrapperPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
import java.util.List;

import io.branch.rnbranch.RNBranchModule;

public class MainApplication extends Application implements ReactApplication {

  private final ReactNativeHost mReactNativeHost =
      new ReactNativeHost(this) {
        @Override
        public boolean getUseDeveloperSupport() {
          return BuildConfig.DEBUG;
        }

        @Override
        protected List<ReactPackage> getPackages() {
          @SuppressWarnings("UnnecessaryLocalVariable")
          List<ReactPackage> packages = new PackageList(this).getPackages();
          // Packages that cannot be autolinked yet can be added manually here, for example:
//           packages.add( new DocumentPickerPackage());
          return packages;
        }

        @Override
        protected String getJSMainModuleName() {
          return "index";
        }
      };

  @Override
  public ReactNativeHost getReactNativeHost() {
    return mReactNativeHost;
  }

  @Override
  public void onCreate() {
    super.onCreate();
    SoLoader.init(this, /* native exopackage */ false);

      RNBranchModule.getAutoInstance(this);
    initializeFlipper(this); // Remove this line if you don't want Flipper enabled
  }

  /**
   * Loads Flipper in React Native templates.
   *
   * @param context
   */
  private static void initializeFlipper(Context context) {
    if (BuildConfig.DEBUG) {
      try {
        /*
         We use reflection here to pick up the class that initializes Flipper,
        since Flipper library is not available in release mode
        */
        Class<?> aClass = Class.forName("com.facebook.flipper.ReactNativeFlipper");
        aClass.getMethod("initializeFlipper", Context.class).invoke(null, context);
      } catch (ClassNotFoundException e) {
        e.printStackTrace();
      } catch (NoSuchMethodException e) {
        e.printStackTrace();
      } catch (IllegalAccessException e) {
        e.printStackTrace();
      } catch (InvocationTargetException e) {
        e.printStackTrace();
      }
    }
  }
}

package.json

{
  "name": "moneymall",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "rnpm": {
    "assets": [
      "./assets/fonts/"
    ]
  },
  "dependencies": {
    "@brlja/react-native-slider": "^0.12.1",
    "@haskkor/react-native-pincode": "^1.21.1",
    "@miblanchard/react-native-slider": "^1.0.2",
    "@react-native-community/async-storage": "^1.6.1",
    "@react-native-community/datetimepicker": "^2.1.0",
    "@react-native-community/slider": "^2.0.0",
    "android-platform-tools": "^3.0.2",
    "axios": "^0.19.2",
    "currency-converter-for-all": "^1.0.5",
    "native-base": "^2.13.13",
    "prop-types": "^15.7.2",
    "react": "16.9.0",
    "react-circular-progressbar": "^2.0.2",
    "react-native": "0.61.5",
    "react-native-awesome-card-io": "^0.8.2",
    "react-native-branch": "^5.0.0-beta.1",
    "react-native-confirmation-code-field": "^4.1.0",
    "react-native-country-picker-modal": "^1.9.8",
    "react-native-date-picker": "^2.7.0",
    "react-native-datepicker": "^1.7.2",
    "react-native-dialogflow": "^3.2.2",
    "react-native-dimension": "^1.0.6",
    "react-native-document-picker": "^2.3.0",
    "react-native-fetch-blob": "^0.10.8",
    "react-native-fingerprint-scanner": "^3.0.2",
    "react-native-gesture-handler": "^1.4.1",
    "react-native-get-real-path": "git+https://github.com/Wraptime/react-native-get-real-path.git",
    "react-native-get-sms-android": "^2.0.0",
    "react-native-image-crop-picker": "^0.26.1",
    "react-native-image-picker": "^1.1.0",
    "react-native-keyboard-aware-scroll-view": "^0.9.1",
    "react-native-keychain": "^3.1.3",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-paypal": "^2.1.0",
    "react-native-paypal-gateway": "^1.0.0",
    "react-native-paypal-wrapper": "^1.3.2",
    "react-native-progress-circle": "^2.0.1",
    "react-native-ratings": "^6.5.0",
    "react-native-reanimated": "^1.2.0",
    "react-native-simple-radio-button": "^2.7.4",
    "react-native-slider": "^0.11.0",
    "react-native-slideshow": "^1.0.1",
    "react-native-snap-carousel": "^3.8.4",
    "react-native-star-rating": "^1.1.0",
    "react-native-step-indicator": "0.0.11",
    "react-native-swiper": "^1.6.0-rc.3",
    "react-native-vector-icons": "^6.6.0",
    "react-native-viewpager": "^0.2.13",
    "react-native-webview": "^7.6.0",
    "react-navigation": "^3.12.1",
    "react-number-format": "^4.4.1"
  },
  "devDependencies": {
    "@babel/core": "^7.5.5",
    "@babel/runtime": "^7.5.5",
    "@react-native-community/eslint-config": "^0.0.5",
    "babel-jest": "^24.9.0",
    "eslint": "^6.2.2",
    "jest": "^24.9.0",
    "metro-react-native-babel-preset": "^0.56.0",
    "react-test-renderer": "16.8.6"
  },
  "jest": {
    "preset": "react-native"
  }
}

0 个答案:

没有答案
相关问题