2017-12-31 53 views
1

ログインしたユーザーがナビゲーションドロワーのアクティビティに移動したときに、Googleマップを使用してその内にAPIを使用してアプリを作成しました。まず、アプリケーションはマニフェストファイルにエラーを表示していません私が作成したときに実行したときに、以下に述べるエラーが表示され、のデバッグ/マニフェストファイル(エラーあり)も表示されます。 (実行前)エラー:アプリケーションの実行とマニフェストの処理に失敗しました。

マニフェストファイル:(実行した後に)

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.example.anasrasheed.MadProject"> 
    <uses-sdk 
    android:minSdkVersion="16" 
    android:targetSdkVersion="26" /> 
android:versionCode="1" 
android:versionName="1.0" > 
<uses-permission android:name="android.permission.INTERNET" /> 
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> 
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> 

<uses-feature 
    android:glEsVersion="0x00020000" 
    android:required="true" /> 

<application 
    android:name=".app.AppController" 
    android:allowBackup="true" 
    android:label="@string/app_name" 
    android:theme="@style/AppTheme"> 
    <activity 
     android:name=".activity.LoginActivity" 
     android:label="@string/app_name" 
     android:launchMode="singleTop" 
     android:windowSoftInputMode="adjustPan"> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 
    <activity 
     android:name=".activity.RegisterActivity" 
     android:label="@string/app_name" 
     android:launchMode="singleTop" 
     android:windowSoftInputMode="adjustPan" /> 
    <activity 
     android:name=".activity.MainActivity" 
     android:label="@string/app_name" 
     android:launchMode="singleTop" /> 

    <activity 
     android:name=".activity.NavigationDrawer" 
     android:label="@string/title_activity_navigation_drawer"></activity> 

    <meta-data 
     android:name="com.google.android.geo..API_KEY" 
     android:value="AIzaSyBWJo_Hlo6ix1927PsMkZJRIvsIz7hrTsM"/> 

</application> 

マニフェストファイル

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.example.anasrasheed.MadProject" > 

<uses-sdk 
    android:minSdkVersion="15" 
    android:targetSdkVersion="26" /> 
android:versionCode="1" 
android:versionName="1.0" > 
<uses-permission android:name="android.permission.INTERNET" /> 
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> 
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> 

<uses-feature 
    android:glEsVersion="0x00020000" 
    android:required="true" /> 

<application 
    android:name="com.example.anasrasheed.MadProject.app.AppController" 
    android:allowBackup="true" 
    android:debuggable="true" 
    android:label="@string/app_name" 
    android:theme="@style/AppTheme" > 
    <activity 
     android:name="com.example.anasrasheed.MadProject.activity.LoginActivity" 
     android:label="@string/app_name" 
     android:launchMode="singleTop" 
     android:windowSoftInputMode="adjustPan" > 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 
    <activity 
     android:name="com.example.anasrasheed.MadProject.activity.RegisterActivity" 
     android:label="@string/app_name" 
     android:launchMode="singleTop" 
     android:windowSoftInputMode="adjustPan" /> 
    <activity 
     android:name="com.example.anasrasheed.MadProject.activity.MainActivity" 
     android:label="@string/app_name" 
     android:launchMode="singleTop" /> 
    <activity 
     android:name="com.example.anasrasheed.MadProject.activity.NavigationDrawer" 
     android:label="@string/title_activity_navigation_drawer" /> 

    <meta-data 
     android:name="com.google.android.geo..API_KEY" 
     android:value="AIzaSyBWJo_Hlo6ix1927PsMkZJRIvsIz7hrTsM" /> 
    <meta-data 
     android:name="android.support.VERSION" 
     android:value="26.0.0" /> 
    <meta-data 
     android:name="com.google.android.gms.version" 
     android:value="@integer/google_play_services_version" /> 
</application> 

Javaファイル1(メイン)

public class MainActivity extends Activity { 

private TextView txtName; 
private TextView txtEmail; 
private Button btnLogout; 
private Button btnCnt; 

private SQLiteOpenHelper db; 
private SessionManager session; 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_main); 

    txtName = (TextView) findViewById(R.id.name); 
    txtEmail = (TextView) findViewById(R.id.email); 
    btnLogout = (Button) findViewById(R.id.btnLogout); 
    btnCnt = (Button) findViewById(R.id.btnContinue); 
    // SqLite database handler 
    db = new SQLiteOpenHelper(getApplicationContext()); 

    // session manager 
    session = new SessionManager(getApplicationContext()); 

    if (!session.isLoggedIn()) { 
     logoutUser(); 
    } 

    // Fetching user details from SQLite 
    HashMap<String, String> user = db.getUserDetails(); 

    String name = user.get("name"); 
    String email = user.get("email"); 


    txtName.setText(name); 
    txtEmail.setText(email); 

    // Logout button click event 
    btnLogout.setOnClickListener(new View.OnClickListener() { 

     @Override 
     public void onClick(View v) { 
      logoutUser(); 
     } 
    }); 
    btnCnt.setOnClickListener(new View.OnClickListener(){ 

     @Override 
     public void onClick(View view) { 
      Continue(); 
     } 
    }); 
} 

/** 
* Logging out the user. Will set isLoggedIn flag to false in shared 
* preferences Clears the user data from sqlite users table 
* */ 
private void logoutUser() { 
    session.setLogin(false); 

    db.deleteUsers(); 

    // Launching the login activity 
    Intent intent = new Intent(MainActivity.this, LoginActivity.class); 
    startActivity(intent); 
    finish(); 

} 
private void Continue(){ 
    session.setLogin(true); 
    Intent int2 = new Intent(MainActivity.this,NavigationDrawerFragment.class); 
    startActivity(int2); 
    finish(); 

} 
} 

Javaファイル2(ナビゲーションドロワー)

public class NavigationDrawer extends Activity 
     implements NavigationDrawerFragment.NavigationDrawerCallbacks { 

/** 
* Fragment managing the behaviors, interactions and presentation of the navigation drawer. 
*/ 
private NavigationDrawerFragment mNavigationDrawerFragment; 

/** 
* Used to store the last screen title. For use in {@link #restoreActionBar()}. 
*/ 
private CharSequence mTitle; 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_navigation_drawer); 

    mNavigationDrawerFragment = (NavigationDrawerFragment) 
      getFragmentManager().findFragmentById(R.id.navigation_drawer); 
    mTitle = getTitle(); 

    // Set up the drawer. 
    mNavigationDrawerFragment.setUp(
      R.id.navigation_drawer, 
      (DrawerLayout) findViewById(R.id.drawer_layout)); 
} 

@Override 
public void onNavigationDrawerItemSelected(int position) { 
    // update the main content by replacing fragments 
    FragmentManager fragmentManager = getFragmentManager(); 
    fragmentManager.beginTransaction() 
      .replace(R.id.container, PlaceholderFragment.newInstance(position + 1)) 
      .commit(); 
} 

public void onSectionAttached(int number) { 
    switch (number) { 
     case 1: 
      mTitle = getString(R.string.title_section1); 
      break; 
     case 2: 
      mTitle = getString(R.string.title_section2); 
      break; 
     case 3: 
      mTitle = getString(R.string.title_section3); 
      break; 
    } 
} 

public void restoreActionBar() { 
    ActionBar actionBar = getActionBar(); 
    assert actionBar != null; 
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); 
    actionBar.setDisplayShowTitleEnabled(true); 
    actionBar.setTitle(mTitle); 
} 

/** 
* A placeholder fragment containing a simple view. 
*/ 
public static class PlaceholderFragment extends Fragment { 
    /** 
    * The fragment argument representing the section number for this 
    * fragment. 
    */ 
    private static final String ARG_SECTION_NUMBER = "section_number"; 

    public PlaceholderFragment() { 
    } 

    /** 
    * Returns a new instance of this fragment for the given section 
    * number. 
    */ 
    public static PlaceholderFragment newInstance(int sectionNumber) { 
     PlaceholderFragment fragment = new PlaceholderFragment(); 
     Bundle args = new Bundle(); 
     args.putInt(ARG_SECTION_NUMBER, sectionNumber); 
      fragment.setArguments(args); 
      return fragment; 
     } 

     @Override 
    public View onCreateView(LayoutInflater inflater, ViewGroup container, 
          Bundle savedInstanceState) { 
     return inflater.inflate(R.layout.fragment_navigation_drawer,  container, false); 
    } 

     @Override 
    public void onAttach(Activity activity) { 
     super.onAttach(activity); 
     ((NavigationDrawer) activity).onSectionAttached(
       getArguments().getInt(ARG_SECTION_NUMBER)); 
     } 
    } 

答えて

0
android:versionCode="1" 
android:versionName="1.0" > 

そのすでにbuild.gradleファイルに定義されたマニフェストからこの二つを削除します。

+0

まだ、エラーが発生しています! –

関連する問題