title: Android Studio not recognizing uses-permission in the AndroidManifest
body: <p>I am having problem where it seems my Android Studio is not recognizing the uses-permission in my AndroidManifest.xml file. In my main activity, when I try to call for some function that requires INTERNET and ACCESS_NETWORK_STATE, the activity seems to not recognize that I have already put the permission in the AndroidManifest.xml file.</p>
  <pre><code>&lt;uses-permission android:name=&quot;android.permission.INTERNET&quot; /&gt;
  &lt;uses-permission android:name=&quot;android.permission.ACCESS_COARSE_LOCATION&quot; /&gt;
  &lt;uses-permission android:name=&quot;android.permission.ACCESS_FINE_LOCATION&quot; /&gt;
  &lt;uses-permission android:name=&quot;android.permission.ACCESS_NETWORK_STATE&quot; /&gt;
  </code></pre>
  <p>The following is the method that calls for the ACCESS_NETWORK_STATE. The part when calling</p>
  <pre><code>public boolean isNetworkAvailable(Context context) {
          boolean isOnline = false;
          ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
          try {
              if (android.os.Build.VERSION.SDK_INT &gt;= android.os.Build.VERSION_CODES.M) {
                  NetworkCapabilities capabilities = manager.getNetworkCapabilities(manager.getActiveNetwork());
                  isOnline = capabilities != null &amp;&amp; capabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED);
              } else {
                  NetworkInfo activeNetworkInfo = manager.getActiveNetworkInfo();
                  isOnline = activeNetworkInfo != null &amp;&amp; activeNetworkInfo.isConnectedOrConnecting();
              }
          } catch (Exception e) {
              e.printStackTrace();
          }
          return isOnline;
      }
  
  private void showConnectDialog() {
          Log.d(TAG, &quot;showConnectDialog: trying to show the connect dialog&quot;);
          AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this,R.style.MyAlertDialogStyle);
          builder.setMessage(&quot;Please connect to the internet to proceed further&quot;)
                  .setCancelable(false)
                  .setPositiveButton(&quot;Connect&quot;, new DialogInterface.OnClickListener() {
                      @Override
                      public void onClick(DialogInterface dialog, int i) {
                          startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
                      }
                  });
          builder.show();
      }
  </code></pre>
  <p>In my main activity oncreate:</p>
  <pre><code>if (!isNetworkAvailable(MainActivity.this)){
              showConnectDialog();
          }
          if (isServicesOK()) {
              init();
          }
  
  MobileAds.initialize(this, new OnInitializationCompleteListener() {
              @Override
              public void onInitializationComplete(InitializationStatus initializationStatus) {
              }
          });
          AdView mAdView = findViewById(R.id.adViewMain);
          AdRequest adRequest = new AdRequest.Builder().build();
          mAdView.loadAd(adRequest);
  </code></pre>
  <p>You can see in the images (attached below) show that I have an error in my isNetworkAvailable method, and also my Google AdMob. If I hover my mouse on the error, Android Studio mentioned that I need to add ACCESS_NETWORK_STATE permission for the isNetworkAvailable method, and INTERNET permission for the Google AdMob. But I already have them in my AndroidManifest.xml. <strong>Am I missing anything else?</strong> Thank you very much for your help.</p>
  <p><a href="https://i.stack.imgur.com/qsPaE.png" rel="nofollow noreferrer">Error in Google AdMob</a></p>
  <p><a href="https://i.stack.imgur.com/Cyu9k.png" rel="nofollow noreferrer">Error in isNetworkAvailable method</a></p>