Android无法找到应用程序的主要活动

时间:2016-11-03 15:08:48

标签: android react-native

我已将反应原点从0.27更新为0.35。将release.apk安装到我的设备后,我只能用adb shell启动它。

安装不会创建桌面'手机上的图标(是的,png-s放置正确),在设置/应用程序管理器中,即使我可以找到我的应用程序及其中的所有信息,我也无法通过其mainActivity启动它。

有什么想法吗?

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="my.pckg.name"
android:versionCode="1"
android:versionName="1.0">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.CALL_PHONE"/>

<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>


<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:screenOrientation="portrait"
                   android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
            android:launchMode="singleTop">

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.LAUNCHER" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />  
            <data android:scheme="http"
                  android:host="my.website.for.DeepLink"
                  android:pathPrefix="/#/register_login/status=successful" />          
        </intent-filter>          
    </activity>
</application></manifest>

MainActivity:

package my.pckg.name;
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 "pckgName";
}}

MainApplication:

package my.pckg.name;

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

import com.facebook.react.ReactApplication;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
//... other stuff
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(),
      //.... other stuff
  );
}
};

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

2 个答案:

答案 0 :(得分:7)

刚想通了:

问题出在mainActivity标记内。 您需要将MainActivity的内部内容与&lt;意图滤光器&gt;标签

之前:

  <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.LAUNCHER" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />  
        <data android:scheme="http"
              android:host="my.website.for.DeepLink"
              android:pathPrefix="/#/register_login/status=successful" />          
    </intent-filter>       

之后(工作人员):

   <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
   </intent-filter>
   <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />  
        <data android:scheme="http"
              android:host="my.website.for.DeepLink"
              android:pathPrefix="/#/register_login/status=successful" />          
    </intent-filter>       

更多信息:https://developer.android.com/guide/components/intents-filters.html#imatch

答案 1 :(得分:1)

您必须在Android Manifest中定义Launcher活动。

Sub CopyPasteLoop()

Dim wsVar As Worksheet

For Each wsVar In ThisWorkbook.Sheets
   With wsVar
      ThisWorkbook.Worksheets("Sheet2").Range("A1:H200").Value = ThisWorkbook.Worksheets("Sheet5").Range("AF1").Value
   End With
Next wsVar

End Sub