2017-05-21 1 views
0

Android 용 React-Native와 너무 가까워서 다음 오류가 발생했습니다.CodePush를 Android 기반의 React-Native로 실행하십시오.

:app:compileDebugJavaWithJavac 
/Users/Spicycurryman/Desktop/Main/Projects/Wosyl-Delivery-1.0-master/android/app/src/main/java/com/wosyldelivery/MainApplication.java:30: error: no suitable constructor found for CodePush(<null>,<anonymous ReactNativeHost>,boolean) 
      new CodePush(null, this, BuildConfig.DEBUG), 
      ^
    constructor CodePush.CodePush(String,Context,boolean,String) is not applicable 
     (actual and formal argument lists differ in length) 
    constructor CodePush.CodePush(String,Context,boolean) is not applicable 
     (actual argument <anonymous ReactNativeHost> cannot be converted to Context by method invocation conversion) 
    constructor CodePush.CodePush(String,Context) is not applicable 
     (actual and formal argument lists differ in length) 
1 error 
:app:compileDebugJavaWithJavac FAILED 

나는 REPO의 지침에 따라이 여기 전체 문맥 내 MainApplication.java에도이 https://github.com/Microsoft/react-native-code-push/issues/790

보고 후 발생하는 이유를 확실하지했습니다.

package com.wosyldelivery; 

import android.app.Application; 
import android.util.Log; 

import com.facebook.react.ReactApplication; 
import com.microsoft.codepush.react.CodePush; 
import com.oblador.vectoricons.VectorIconsPackage; 
import com.facebook.react.ReactInstanceManager; 
import com.facebook.react.ReactNativeHost; 
import com.facebook.react.ReactPackage; 
import com.facebook.react.shell.MainReactPackage; 


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

public class MainApplication extends Application implements ReactApplication { 

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

    @Override 
    protected List<ReactPackage> getPackages() { 
     return Arrays.<ReactPackage>asList(
      new MainReactPackage(), 
      new CodePush(null, this, BuildConfig.DEBUG), 
      new VectorIconsPackage() 
    ); 
    } 
    @Override 
    protected String getJSBundleFile() { 
     return CodePush.getJSBundleFile(); 
    } 
    }; 

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

이 오류가 발생하는 이유는 무엇입니까? 어떻게 해결 될 수 있습니까? 이에 CodePush의

+0

null을 일부 문자열 (예 : "")로 바꿔보십시오 –

+0

@PriyeshKumar 불행히도 같은 오류가 발생했습니다 –

+0

해결 방법에 대한 다른 아이디어는 있습니까? –

답변

0

변경 인스턴스화는 :

new CodePush("deployment-key-here", MainApplication.this, BuildConfig.DEBUG) 
1
new CodePush("deployment-key", getApplicationContext(), BuildConfig.DEBUG) 

deployment-key하면 코드 푸시 계정을 등록하고 null 일 수 없습니다 때 당신이 얻을 것이다 영숫자 문자열입니다.

관련 문제