在尝试启动我的应用程序时,我的com.example.leflagrantdlit软件包有问题。以前它曾经可以正常工作,logcat也没有给我任何关于它可能是什么的特定错误。.我还尝试了重建项目,重置AVD和更新Android Studio。感谢您的帮助。
LogCat:
2019-03-10 15:11:58.339 1841-1855/? I/ActivityManager: Force stopping
com.example.leflagrantdlit appid=10093 user=-1: installPackageLI
2019-03-10 15:11:58.459 1841-1868/? I/PackageManager: Update package com.example.leflagrantdlit code path from /data/app/com.example.leflagrantdlit-nqimnCWYKDWpxXmy2w24zw== to /data/app/com.example.leflagrantdlit-XTepHPo_ZwTpnqslCYV28w==; Retain data and using new
2019-03-10 15:11:58.459 1841-1868/? I/PackageManager: Update package com.example.leflagrantdlit resource path from /data/app/com.example.leflagrantdlit-nqimnCWYKDWpxXmy2w24zw== to /data/app/com.example.leflagrantdlit-XTepHPo_ZwTpnqslCYV28w==; Retain data and using new
2019-03-10 15:11:58.664 1841-1868/? I/ActivityManager: Force stopping com.example.leflagrantdlit appid=10093 user=0: pkg removed
2019-03-10 15:11:58.695 1841-1855/? W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.example.leflagrantdlit flg=0x4000010 (has extras) } to com.android.musicfx/.Compatibility$Receiver
2019-03-10 15:11:58.695 1841-1855/? W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.example.leflagrantdlit flg=0x4000010 (has extras) } to com.android.vending/com.google.android.finsky.packagemanager.impl.PackageMonitorReceiverImpl$RegisteredReceiver
2019-03-10 15:11:58.695 1841-1855/? W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.example.leflagrantdlit flg=0x4000010 (has extras) } to com.android.vending/com.google.android.finsky.instantapps.appmanagement.InstantAppRemoveMonitor
2019-03-10 15:11:58.695 1841-1855/? W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.example.leflagrantdlit flg=0x4000010 (has extras) } to com.google.android.gms/.games.chimera.GamesSystemBroadcastReceiverProxy
2019-03-10 15:11:58.696 1841-1855/? W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.example.leflagrantdlit flg=0x4000010 (has extras) } to com.google.android.gms/.photos.autobackup.PhotosAppUninstalledReceiver
2019-03-10 15:11:58.696 1841-1855/? W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.example.leflagrantdlit flg=0x4000010 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver
2019-03-10 15:11:58.696 1841-1855/? W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.example.leflagrantdlit flg=0x4000010 (has extras) } to com.google.android.googlequicksearchbox/com.google.android.apps.gsa.googlequicksearchbox.GelStubAppWatcher
2019-03-10 15:11:58.696 1841-1855/? W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.example.leflagrantdlit flg=0x4000010 (has extras) } to com.android.musicfx/.Compatibility$Receiver
2019-03-10 15:11:58.696 1841-1855/? W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.example.leflagrantdlit flg=0x4000010 (has extras) } to com.android.vending/com.google.android.finsky.packagemanager.impl.PackageMonitorReceiverImpl$RegisteredReceiver
2019-03-10 15:11:58.697 1841-1855/? W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.example.leflagrantdlit flg=0x4000010 (has extras) } to com.google.android.gms/.games.chimera.GamesSystemBroadcastReceiverProxy
2019-03-10 15:11:58.697 1841-1855/? W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.example.leflagrantdlit flg=0x4000010 (has extras) } to com.google.android.gms/.gass.chimera.PackageChangeBroadcastReceiver
2019-03-10 15:11:58.697 1841-1855/? W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.example.leflagrantdlit flg=0x4000010 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver
2019-03-10 15:11:58.697 1841-1855/? W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.example.leflagrantdlit flg=0x4000010 (has extras) } to com.google.android.googlequicksearchbox/com.google.android.apps.gsa.googlequicksearchbox.GelStubAppWatcher
2019-03-10 15:11:58.821 1841-1851/? W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_REPLACED dat=package:com.example.leflagrantdlit flg=0x4000010 (has extras) } to com.android.musicfx/.Compatibility$Receiver
2019-03-10 15:11:58.834 1841-1855/? W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_REPLACED dat=package:com.example.leflagrantdlit flg=0x4000010 (has extras) } to com.google.android.apps.photos/.account.full.FetchAccountPropertiesAppUpgradeBroadcastReceiver
2019-03-10 15:11:58.834 1841-1855/? W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_REPLACED dat=package:com.example.leflagrantdlit flg=0x4000010 (has extras) } to com.google.android.apps.photos/.account.full.SyncAccountsForLoginBroadcastReceiver
2019-03-10 15:11:58.834 1841-1855/? W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_REPLACED dat=package:com.example.leflagrantdlit flg=0x4000010 (has extras) } to com.google.android.apps.photos/.experiments.phenotype.full.PhenotypeAppUpgradeBroadcastReceiver
2019-03-10 15:11:58.834 1841-1855/? W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_REPLACED dat=package:com.example.leflagrantdlit flg=0x4000010 (has extras) } to com.google.android.apps.photos/.notificationchannels.AppUpdateBroadcastReceiver
2019-03-10 15:11:58.834 1841-1855/? W/BroadcastQueue: Background execution not
allowed: receiving Intent { act=android.intent.action.PACKAGE_REPLACED dat=package:com.example.leflagrantdlit flg=0x4000010 (has extras) } to com.google.android.gms/.gass.chimera.PackageChangeBroadcastReceiver
2019-03-10 15:11:58.835 1841-1855/? W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_REPLACED dat=package:com.example.leflagrantdlit flg=0x4000010 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver
2019-03-10 15:11:58.835 1841-1855/? W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_REPLACED dat=package:com.example.leflagrantdlit flg=0x4000010 (has extras) } to com.google.android.googlequicksearchbox/com.google.android.apps.gsa.googlequicksearchbox.GelStubAppWatcher
2019-03-10 15:11:58.865 2958-2958/? I/Finsky: [2] idt.run(4): Package state data is missing for com.example.leflagrantdlit
2019-03-10 15:11:58.936 2958-2958/? I/Finsky: [2] idt.run(4): Package state data is missing for com.example.leflagrantdlit
2019-03-10 15:11:58.946 2958-2958/? I/Finsky: [2] idt.run(4): Package state data is missing for com.example.leflagrantdlit
2019-03-10 15:11:58.965 2374-14411/? I/ChromeSync: [Sync,SyncIntentOperation] Handling the intent: Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.example.leflagrantdlit flg=0x4000010
cmp=com.google.android.gms/.chimera.GmsIntentOperationService (has extras) }.
2019-03-10 15:11:59.002 2374-14412/? I/FontsPackageChangeOp: Package com.example.leflagrantdlit has no metadata
2019-03-10 15:11:59.473 2091-2091/? D/ImsResolver: maybeAddedImsService,
MainActivity类
package com.example.leflagrantdlit;
import android.content.Intent;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TextView;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
private static final String TAG = "MainActivity";
private ListView listArticles;
private TextView tvTitre;
private ArrayList<FeedEntry> articles;
public MainActivity() {
this.articles = new ArrayList<>();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);//will hide the title
getSupportActionBar().hide(); //hide the title bar
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
listArticles = findViewById(R.id.htmlListView);
tvTitre = findViewById(R.id.tvTitre);
tvTitre.setText("Le Flagrant Délit");
listArticles.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
startActivity(new Intent(MainActivity.this, ArticleView.class));
Log.d(TAG, "onItemClick: " + position);
}
});
getWebsite();
}
// public void progressAnimation()
// {
// ProgressBarAnimation anim = new ProgressBarAnimation(this, progressBar, textView,0f,100f);
// anim.setDuration(8000);
// progressBar.setAnimation(anim);
//
//
// }
private void getWebsite() {
DownloadData downloadData = new DownloadData();
downloadData.execute("http://www.flagrantdelit.ca");
}
private class DownloadData extends AsyncTask<String, Void, String> {
private static final String TAG = "DownloadData";
@Override
protected String doInBackground(String... strings) {
Log.d(TAG, "doInBackground: starts with " + strings[0]);
String htmlData = downloadHtml(strings[0]);
if (htmlData == null) {
Log.e(TAG, "doInBackground: Error downloading ");
}
Log.d(TAG, "doInBackground: " + htmlData);
return htmlData;
}
@Override
protected void onPostExecute(String s) {
super.onPostExecute(s);
FeedAdapter feedAdapter = new FeedAdapter(MainActivity.this, R.layout.list_record, articles);
listArticles.setAdapter(feedAdapter);
// ParseApplications parseApplications = new ParseApplications();
// parseApplications.parse(s);
//
//// ArrayAdapter<FeedEntry> arrayAdapter = new ArrayAdapter<FeedEntry>(
//// MainActivity.this, R.layout.list_item, parseApplications.getApplications());
//// listApps.setAdapter(arrayAdapter);
//
// FeedAdapter feedAdapter = new FeedAdapter(MainActivity.this, R.layout.list_record,
// parseApplications.getApplications());
// listApps.setAdapter(feedAdapter);
}
private String downloadHtml(String urlPath) {
FeedEntry currentRecord = null;
// StringBuilder htmlResult = new StringBuilder();
try {
Document doc = Jsoup.connect(urlPath).get();
int numberPages = Integer.parseInt(doc.select("a.page-numbers").get(1).text());
// Elements imgUrl = doc.select("a > img[src$=.jpg]"); //"div.entry-media > a"
for (int z = 1; z <= numberPages; z++) {
String new_url = urlPath + "/page/" + z + "/";
doc = Jsoup.connect(new_url).get();
Elements listTitle = doc.getElementsByClass("entry-title");
int titleCount = listTitle.size();
for (int i = 0; i <= (titleCount - 1); i++) {
//Element entryTitle : doc.select("h2.entry-title")
//Initialize the arraylist
currentRecord = new FeedEntry();
// String title = doc.getElementsByClass("entry-title").get(i).text();
// substring(0,2) + " " + textReleaseDate.substring(2,5);
// String Title = doc.getElementsByClass("entry-title").get(i).text();
String title = doc.getElementsByClass("entry-title").get(i).text();
String summary = doc.getElementsByClass("entry-content").get(i).text();
String releaseDate = doc.getElementsByClass("entry-date").get(i).text();
Element images = doc.getElementsByTag("article").select("img").get(i);
String imgUrl = images.absUrl("src");
String formattedReleaseDate = releaseDate.substring(0, 2) + " " + releaseDate.substring(2, 5).toLowerCase();
articles.add(currentRecord);
currentRecord.setTitle(title);
currentRecord.setReleaseDate(formattedReleaseDate);
currentRecord.setSummary(summary);
currentRecord.setImageUrl(imgUrl);
// Log.d(TAG, "downloadHtml: " + title);
Log.d(TAG, "downloadHtml: " + title + " " + imgUrl);
}
}
return null;
} catch (MalformedURLException e) {
Log.e(TAG, "downloadHTML: Invalid Url " + e.getMessage());
} catch (IOException e) {
Log.e(TAG, "downloadHTML: IO Exception reading data: " + e.getMessage());
} catch (SecurityException e) {
Log.e(TAG, "downloadHTML: Security Exception. Need permission? " + e.getMessage());
// e.printStackTrace();
}
return null;
}
}
}