誰かが正しい方向に向けるかどうかわかりません。 - 私は "反応ネイティブランアンドロイド"私のアプリをしようとしています。 - "react-native init"によって作成されたファイル構造 - USB接続デバイスにプッシュしようとすると、エミュレータとうまく動作します。 - ビルドに成功し、apkがインストールされ、すぐにクラッシュします。反応しないネイティブ - アクティビティを開始できませんComponentInfo {com.mobile/com.mobile.MainActivity}:java.lang.IllegalArgumentException:予期しないURL:http://
デバイスログからのエラー:
11-20 18:16:28.513 18430 18430 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mobile/com.mobile.MainActivity}: java.lang.IllegalArgumentException: unexpected url: http://
11-20 18:16:28.513 18430 18430 E AndroidRuntime:
11-20 18:16:28.513 18430 18430 E AndroidRuntime:
11-20 18:16:28.513 18430 18430 E AndroidRuntime: 192.168.2.74/status
それがサーバーや携帯電話に合わせdoesntのからそのIPが出番私はわかりません。
例外がOkhttp要求ビルダーによってスローされます。
public Builder url(String url) {
if (url == null) throw new NullPointerException("url == null");
// Silently replace web socket URLs with HTTP URLs.
if (url.regionMatches(true, 0, "ws:", 0, 3)) {
url = "http:" + url.substring(3);
} else if (url.regionMatches(true, 0, "wss:", 0, 4)) {
url = "https:" + url.substring(4);
}
HttpUrl parsed = HttpUrl.parse(url);
if (parsed == null) throw new IllegalArgumentException("unexpected url: " + url);
return url(parsed);
}
マイmainActivity:
package com.mobile;
import com.facebook.react.ReactActivity;
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 "mobile";
}
}
MainApplication:
package com.mobile;
import android.app.Application;
import com.facebook.react.ReactApplication;
import com.microsoft.codepush.react.CodePush;
import com.transistorsoft.rnbackgroundgeolocation.RNBackgroundGeolocation;
import com.oblador.vectoricons.VectorIconsPackage;
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
protected String getJSBundleFile() {
return CodePush.getJSBundleFile();
}
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new CodePush(getResources().getString(R.string.reactNativeCodePush_androidDeploymentKey), getApplicationContext(), BuildConfig.DEBUG),
new RNBackgroundGeolocation(),
new VectorIconsPackage()
);
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}
マニフェスト:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mobile"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="22" />
<application
android:name=".MainApplication"
android:allowBackup="true"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
</manifest>
アイデア?
どのような考えですか?私は私の最高の手がかりだと大胆に思った。
更新日: 私は、コードプッシュを含むすべての外部ライブラリをコメントアウトしてみましたが、それを閉じるにはまだ同じ結果が表示されています。
更新: また、新しいプロジェクトw/rn initを作成しました。私はそれを構築し、ちょうど良い、クラッシュしないでデバイスに送った。だからADBとそのすべてのものは正常に動作しているようです。