-1

私はEarthquake Reportingアプリケーションを使用しています。インターネットとACCESS_NETWORK_STATEのマニフェストファイルへのアクセス許可を追加しました。私はエミュレータの設定と開発者の設定に行き、すべてのネットワーク設定が適切に設定されていることを確認しました。私はここで質問を研究した&私のために働かなかったそれらの提案を試してみました。私はまた、他の人がファイアウォールのためにこの問題を抱えている場所を見た私はNortonを実行していますが、修正指示は私の頭の上にあります。コマンドラインから、または[設定]> [HTTPプロキシ]ダイアログボックスから、Androidスタジオでプロキシを設定するための何か。そこで、「プロキシ設定の自動検出」が選択されています。私がプロキシ設定を手動で設定するのであれば、情報の入力先はわかりません。誰かが私がこれを修正する方法について提案があれば(私は&を再構築しましたが、これはこの問題の2日目です)、共有してください!ユーザー10063も現在のプロセスもありません。android.permission.ACCESS_NETWORK_STATE

<?xml version="1.0" encoding="utf-8"?> 

<application 
    android:allowBackup="true" 
    android:icon="@mipmap/ic_launcher" 
    android:label="@string/app_name" 
    android:supportsRtl="true" 
    android:theme="@style/AppTheme"> 

    <uses-permission android:name="android.permission.INTERNET" /> 
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 

    <activity android:name=".EarthquakeActivity"> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 
      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity><!-- ATTENTION: This was auto-generated to add Google Play services to your project for 
App Indexing. See https://g.co/AppIndexing/AndroidStudio for more information. --> 
    <meta-data 
     android:name="com.google.android.gms.version" 
     android:value="@integer/google_play_services_version" /> 
</application> 

public class EarthquakeActivity extends AppCompatActivity 
    implements LoaderManager.LoaderCallbacks<List<Earthquake>> { 

private static final String LOG_TAG = EarthquakeActivity.class.getName(); 

/** URL for earthquake data from the USGS dataset */ 
private static final String USGS_REQUEST_URL = 
     "http://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&orderby=time&minmag=6&limit=10"; 

private static final int EARTHQUAKE_LOADER_ID = 1; 

/** Adapter for the list of earthquakes */ 
private EarthquakeAdapter mAdapter; 

/** TextView that is displayed when the list is empty */ 
private TextView mEmptyStateTextView; 

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

    // Find a reference to the {@link ListView} in the layout 
    ListView earthquakeListView = (ListView) findViewById(R.id.list); 

    mEmptyStateTextView = (TextView) findViewById(R.id.empty_view); 
    earthquakeListView.setEmptyView(mEmptyStateTextView); 

    // Create a new adapter that takes an empty list of earthquakes as input 
    mAdapter = new EarthquakeAdapter(this, new ArrayList<Earthquake>()); 

    // Set the adapter on the {@link ListView} 
    // so the list can be populated in the user interface 
    earthquakeListView.setAdapter(mAdapter); 

    // Set an item click listener on the ListView, which sends an intent to a web browser 
    // to open a website with more information about the selected earthquake. 
    earthquakeListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { 
     @Override 
     public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) { 
      // Find the current earthquake that was clicked on 
      Earthquake currentEarthquake = mAdapter.getItem(position); 

      // Convert the String URL into a URI object (to pass into the Intent constructor) 
      Uri earthquakeUri = Uri.parse(currentEarthquake.getUrl()); 

      // Create a new intent to view the earthquake URI 
      Intent websiteIntent = new Intent(Intent.ACTION_VIEW, earthquakeUri); 

      // Send the intent to launch a new activity 
      startActivity(websiteIntent); 
     } 
    }); 



    // Get a reference to the ConnectivityManager to check state of network connectivity 
    ConnectivityManager connMgr = (ConnectivityManager) 
      getSystemService(Context.CONNECTIVITY_SERVICE); 

    // Get details on the currently active default data network 
    NetworkInfo networkInfo = connMgr.getActiveNetworkInfo(); 

    // If there is a network connection, fetch data 
    if (networkInfo != null && networkInfo.isConnected()) { 
     // Get a reference to the LoaderManager, in order to interact with loaders. 
     LoaderManager loaderManager = getLoaderManager(); 

     // Initialize the loader. Pass in the int ID constant defined above and pass in null for 
     // the bundle. Pass in this activity for the LoaderCallbacks parameter (which is valid 
     // because this activity implements the LoaderCallbacks interface). 
     loaderManager.initLoader(EARTHQUAKE_LOADER_ID, null, this); 
    } else { 
     // Otherwise, display error 
     // First, hide loading indicator so error message will be visible 
     View loadingIndicator = findViewById(R.id.loading_indicator); 
     loadingIndicator.setVisibility(View.GONE); 

     // Update empty state with no connection error message 
     mEmptyStateTextView.setText(R.string.no_internet_connection); 
    } 
} 

@Override 
public Loader<List<Earthquake>> onCreateLoader(int i, Bundle bundle) { 
    // Create a new loader for the given URL 
    return new EarthquakeLoader(this, USGS_REQUEST_URL); 
} 

@Override 
public void onLoadFinished(Loader<List<Earthquake>> loader, List<Earthquake> earthquakes) { 
    // Hide loading indicator because the data has been loaded 
    View loadingIndicator = findViewById(R.id.loading_indicator); 
    loadingIndicator.setVisibility(View.GONE); 

    // Set empty state text to display "No earthquakes found." 
    mEmptyStateTextView.setText(R.string.no_earthquakes); 

    // Clear the adapter of previous earthquake data 
    mAdapter.clear(); 

    // If there is a valid list of {@link Earthquake}s, then add them to the adapter's 
    // data set. This will trigger the ListView to update. 
    if (earthquakes != null && !earthquakes.isEmpty()) { 
     mAdapter.addAll(earthquakes); 
    } 
} 

@Override 
public void onLoaderReset(Loader<List<Earthquake>> loader) { 
    // Loader reset, so we can clear out our existing data. 
    mAdapter.clear(); 
} 

}

+0

上記のようにしてください。あなたが反対にアプリをテストしているだけのマニフェストタグ以下のアプリケーションの外部の使用許可する必要がありますマシュマロまたはヌーガット? –

答えて

2

これは、あなたのmenifestファイルにいくつかの誤った情報や不正な形式の情報を持っており、それはあなたの許可のいずれでもない理由であることを意味しますあなたのアプリによって特定されていません。あなたが誤った形式のデータでANDROIDMANIFESTファイルをきれいにしたことを確認してください。

それは動作しますし、すべての権限は、外部のアプリケーションタグ

移動

<uses-permission android:name="android.permission.INTERNET" /> 
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 

<application 
    android:allowBackup="true" 
    android:icon="@mipmap/ic_launcher" 
    android:label="@string/app_name" 
    android:supportsRtl="true" 
    android:theme="@style/AppTheme"> 

+0

ああ、私のマニフェストには誤りはなく、適切な権限が列挙されています(コード参照)。正直なところ、ありがとう! – Joy

+1

あなたはアプリケーションタグ内にあなたの許可を設定しました。それはアプリケーションタグ – siddhesh

+0

の外にあるべきです!はい、そうでした!ありがとうございました! – Joy

関連する問題