2016-09-07 5 views
0

React Native 앱에 간단한 모듈을 추가하고 싶습니다. 그러나 나는 오류가 :React Native에 모듈 추가 - 오류 : 심볼을 찾을 수 없습니다.

package com.androiddepends; 

import com.facebook.react.bridge.NativeModule; 
import com.facebook.react.bridge.ReactApplicationContext; 
import com.facebook.react.bridge.ReactContext; 
import com.facebook.react.bridge.ReactContextBaseJavaModule; 
import com.facebook.react.bridge.ReactMethod; 
import android.util.Log; 

public class HelloWorld extends ReactContextBaseJavaModule { 

    public HelloWorld(ReactApplicationContext reactContext) { 
     super(reactContext); 
    } 

    @Override 
    public String getName() { 
     return "HelloWorld"; 
    } 

    @ReactMethod 
    public void openWifiSettings() { 
    Intent intent = new Intent(Intent.ACTION_WIFI_SETTINGS); 
    if (intent.resolveActivity(getPackageManager()) != null) { 
     startActivity(intent); 
    } 
} 
} 

어떤 아이디어 :

여기
:app:compileDebugJavaWithJavacE:\project\android\app\src\main\java\com\androiddepends\HelloWorld.java:23: error: cannot find symbol 
    Intent intent = new Intent(Intent.ACTION_WIFI_SETTINGS); 
    ^
    symbol: class Intent 
    location: class HelloWorld 
E:\project\android\app\src\main\java\com\androiddepends\HelloWorld.java:23: error: cannot find symbol 
    Intent intent = new Intent(Intent.ACTION_WIFI_SETTINGS); 
         ^
    symbol: class Intent 
    location: class HelloWorld 
E:\project\android\app\src\main\java\com\androiddepends\HelloWorld.java:23: error: cannot find symbol 
    Intent intent = new Intent(Intent.ACTION_WIFI_SETTINGS); 
          ^
    symbol: variable Intent 
    location: class HelloWorld 
E:\project\android\app\src\main\java\com\androiddepends\HelloWorld.java:24: error: cannot find symbol 
    if (intent.resolveActivity(getPackageManager()) != null) { 
          ^
    symbol: method getPackageManager() 
    location: class HelloWorld 
4 errors 
FAILED 

코드인가?

답변

0

가져 오기 섹션에서 찾을 수없는 android SDK의 인 텐트 패키지를 가져와야합니다.

android.content.Intent

문제는 SDK의 의도 클래스가 없습니다.

+0

작동하지 않습니다. 나는'import android.content.Intent; '와 여전히 같은 오류를 추가했다. – slowydown

+0

작동하면 청소하고 다시 작성하십시오. 안드로이드 스튜디오 설정 또는 다른 설정 즉 원자 및 명령 줄 도구를 사용하고 있습니까? –

+0

PHPStrom을 사용했지만 프로젝트를 Android Studio로 옮깁니다. Android Studio에서 React Native 프로젝트를 다시 작성하는 방법은 무엇입니까? – slowydown

관련 문제