简体   繁体   English

React Native-任务':app:compileDebugJavaWithJavac'的执行失败

[英]React Native - Execution failed for task ':app:compileDebugJavaWithJavac'

I made the mistake of building my React Native project and only testing on the IOS simulator. 我犯了一个错误,那就是构建我的React Native项目并仅在IOS模拟器上进行测试。 I've tackled most of the bugs that where thrown when I finally tried to build the project in Android Studio but there are still three errors that are driving me insane. 我已经解决了我最终尝试在Android Studio中构建项目时抛出的大多数错误,但是仍然有三个错误使我发疯。

1) 1)

Error:(38, 3) error: method does not override or implement a method from a supertype

2) 2)

Error:(41, 12) error: cannot find symbol method onRequestPermissionsResult(int,String[],int[])

3) 3)

 Error:Execution failed for task :app:compileDebugJavaWithJavac.
> Compilation failed; see the compiler error output for details.

I think the first two errors are referring to this subclass in my MainApplication.java 我认为前两个错误是在MainApplication.java中引用此子类的

 @Override
  public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
      CalendarEventsPackage.onRequestPermissionsResult(requestCode, permissions, grantResults);
      super.onRequestPermissionsResult(requestCode, permissions, grantResults);
  }

Here is the rest of the file for context: 这是上下文的文件其余部分:

package com.fit.fitmobile;

import android.support.multidex.MultiDexApplication;

import com.facebook.react.ReactPackage;

import java.util.Arrays;
import java.util.List;

// Needed for `react-native link`
// import com.facebook.react.ReactApplication;
import com.geektime.rnonesignalandroid.ReactNativeOneSignalPackage;
import com.calendarevents.CalendarEventsPackage;
import com.airbnb.android.react.maps.MapsPackage;

public class MainApplication extends MultiDexApplication {

  // Needed for `react-native link`
  public List<ReactPackage> getPackages() {
    return Arrays.<ReactPackage>asList(
        // Add your own packages here!
        // TODO: add cool native modules

        // Needed for `react-native link`
//         new MainReactPackage(),
            new ReactNativeOneSignalPackage(),
            new CalendarEventsPackage(),
            new MapsPackage(),
            new CalendarEventsPackage(),
            new ReactNativeOneSignalPackage()
    );
  }

  // Code for target SDK versions 23 and over.
  @Override
  public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
      CalendarEventsPackage.onRequestPermissionsResult(requestCode, permissions, grantResults);
      super.onRequestPermissionsResult(requestCode, permissions, grantResults);
  }
}

The third error I've researched and tried debugging for 3 days now, but haven't made any progress. 我已经研究并尝试调试3天的第三个错误,但没有取得任何进展。 If anyone has any input I would be forever grateful! 如果有人有任何意见,我将永远感激不已!

onRequestPermissionsResult is not available for the Application class. onRequestPermissionsResult不适用于Application类。 You have to override it in the Activity class. 您必须在Activity类中覆盖它。 Please check out the docs. 请检查文档。

Also here you can get a sample implementation. 同样在这里,您可以获得示例实现。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 任务&#39;:app:compileDebugJavaWithJavac&#39;的执行失败反应本机 - Execution failed for task ':app:compileDebugJavaWithJavac' react native 任务“:app:compileDebugJavaWithJavac”执行失败。 在运行 React Native 项目时 - Execution failed for task ':app:compileDebugJavaWithJavac'. while running React Native Project React-native 问题 - 任务 ':app:compileDebugJavaWithJavac' 执行失败 - React-native problem - Execution failed for task ':app:compileDebugJavaWithJavac' 任务&#39;:app:compileDebugJavaWithJavac&#39;的执行失败。 适用于Android的React Native应用程序 - Execution failed for task ':app:compileDebugJavaWithJavac'. React Native application for Android 任务 &#39;:app:compileDebugJavaWithJavac&#39; 的 Android 执行失败。 - 反应原生 - Android Execution failed for task ':app:compileDebugJavaWithJavac'. - React Native 任务&#39;:app:compileDebugJavaWithJavac的执行失败 - Execution failed for task ':app:compileDebugJavaWithJavac 任务执行失败:app:compileDebugJavaWithJavac - Execution failed for task :app:compileDebugJavaWithJavac 任务应用程序的执行失败:compileDebugJavaWithJavac - Execution failed for task app:compileDebugJavaWithJavac 任务 &#39;:app:compileDebugJavaWithJavac&#39; 执行失败: - Execution failed for task ':app:compileDebugJavaWithJavac': 任务 &#39;:react-native-lock:compileDebugJavaWithJavac&#39; 执行失败 - Execution failed for task ':react-native-lock:compileDebugJavaWithJavac'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM