2017-08-11 22 views
0

反応ネイティブスマートスプラッシュ画面/アンドロイド/ src/main/java/com/reactnativecomponent/splashscreen/RCTSplashScreenPackage.java:23:エラー:メソッドがオーバーライドまたは実装されません反応するネイティブ・スマート・スプラッシュスクリーン:スーパー @Override ^ 1つのエラー からメソッドの例外で失敗しましたビルド:compileReleaseJavaWithJavacはエラー:反応 - ネイティブスマートスプラッシュ画面

FAILUREに失敗しました。

何が悪かったのか
  • : 実行がタスクに失敗しました「:反応するネイティブ・スマート・スプラッシュスクリーン:compileReleaseJavaWithJavac」。

    Compilation failed; see the compiler error output for details.

  • してみてください。スタックトレースを取得する--stacktraceオプション付き 実行します。より多くのログ出力を得るには、--infoまたは--debugオプションを指定して実行します。

BUILDは

合計時間

をFAILED:9.971秒 は、デバイス上のアプリをインストールする詳細については、上記のエラーを読み取ることができませんでした。 RCTSplashScreenPackage
import com.facebook.react.ReactActivity; 
import android.content.Intent; 
import android.content.res.Configuration; 
import android.os.Bundle; 

import com.reactnativecomponent.splashscreen.RCTSplashScreen; 

public class MainActivity extends ReactActivity { 

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

    @Override 
    public void onConfigurationChanged(Configuration newConfig) { 
     super.onConfigurationChanged(newConfig); 
     Intent intent = new Intent("onConfigurationChanged"); 
     intent.putExtra("newConfig", newConfig); 
     this.sendBroadcast(intent); 
    } 

    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     RCTSplashScreen.openSplashScreen(this); //open splashscreen 
     //RCTSplashScreen.openSplashScreen(this, true, ImageView.ScaleType.FIT_XY); //open splashscreen fullscreen 
     super.onCreate(savedInstanceState); 
    } 
} 

MainActivity.java

import android.app.Application; 

import com.facebook.react.ReactApplication; 
import com.github.yamill.orientation.OrientationPackage; 
import com.reactnativecomponent.splashscreen.RCTSplashScreenPackage; 
import com.facebook.react.ReactNativeHost; 
import com.facebook.react.ReactPackage; 
import com.facebook.react.shell.MainReactPackage; 
import com.facebook.soloader.SoLoader; 

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



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() { 
     return Arrays.<ReactPackage>asList(
      new MainReactPackage(), 
      new OrientationPackage() 
    ); 
    } 

    @Override 
    protected List<ReactPackage> getPackages() { 
     return Arrays.<ReactPackage>asList(
       new MainReactPackage(), 
       new RCTSplashScreenPackage() //register Module 
    ); 
    } 
    }; 

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

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

MainApplication.java

https://facebook.github.io/react-native/docs/android-setup.html

: を使用すると、Androidのエミュレータ実行中または接続されたデバイスを持っていると は、あなたのAndroid開発環境をセットアップしていることを確認してください

package com.reactnativecomponent.splashscreen; 

import com.facebook.react.ReactPackage; 
import com.facebook.react.bridge.JavaScriptModule; 
import com.facebook.react.bridge.NativeModule; 
import com.facebook.react.bridge.ReactApplicationContext; 
import com.facebook.react.uimanager.ViewManager; 

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


public class RCTSplashScreenPackage implements ReactPackage { 

    @Override 
    public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) { 
     return Arrays.<NativeModule>asList(
       new RCTSplashScreenModule(reactContext) 
     ); 
    } 

    @Override 
    public List<Class<? extends JavaScriptModule>> createJSModules() { 
     return Collections.emptyList(); 
    } 

    @Override 
    public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { 
     return Arrays.<ViewManager>asList(); 
    } 
} 
+0

あなたの質問が何であるか、それを修正しようとしていることを明確にしてください。 https://stackoverflow.com/help/how-to-ask – Kai

答えて

1

はい、これはRN 0.47.1の更新後に発生する最も一般的なエラーです。 最新リリースhereを確認できます。

リリースで記載されています未使用のcreateJSModulesを削除するには、を呼び出します。あなたのRCTSplashScreenPackage内したがって これらの行を削除したり、コメント

@Override 
public List<Class<? extends JavaScriptModule>> createJSModules() { 
    return Collections.emptyList(); 
} 

は、私は、これは誰に役立ちます願っています。

+0

私のために働いた...ありがとう! –

関連する問題