嗨朋友我是android编程的新手。当我尝试从URL检索数据时,我的应用程序关闭。我只从url文件中获取title,date_taken和media标签。帮助我
listview活动 包com.suni.sun;
import java.util.ArrayList;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import com.suni.sun.JsonParse;
import com.suni.sun.HomeGv;
public class ListViewActivity extends Activity {
private ListView lv;
private ArrayList<HomeGv> img;
private ArrayAdapter<HomeGv> adap;
private final static String TAG = ListViewActivity.class.getSimpleName();
private final static String url = "http://saicloudica.cloudapp.net/json.txt";
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.home);
lv = (ListView) findViewById(R.id.listView);
setListViewAdapter();
getDataFromInternet();
}
private void getDataFromInternet(){
new JsonParse(this, url).execute();
}
private void setListViewAdapter(){
img = new ArrayList<HomeGv>();
adap = new CustomListViewAdapter(this, R.layout.home_item, img);
lv.setAdapter(adap);
}
public void parseJsonResponse(String result){
Log.i(TAG, result);
try{
JSONObject json = new JSONObject(result);
JSONArray jArray = new JSONArray(json.getString("items"));
for (int i = 0; i < jArray.length(); i++){
JSONObject jObj = jArray.getJSONObject(i);
HomeGv imgs = new HomeGv();
imgs.setTitle(jObj.getString("title"));
imgs.setDate(jObj.getString("date_taken"));
if(json.has("media"))
{
JSONObject media = jObj.getJSONObject("media");
if(null != media && media.length() > 0)
{
String medi = media.getString("m");
if(medi != null)
{
imgs.setMedia(media.getString("m"));
}
}
}
img.add(imgs);
}
adap.notifyDataSetChanged();
} catch (JSONException e){
e.printStackTrace();
}
}
@Override
public void onBackPressed() {
// TODO Auto-generated method stub
Intent intent = new Intent(getApplicationContext(), MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra("EXIT", true);
startActivity(intent);
}
}
jsonparse类
package com.suni.sun;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Activity;
import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.util.Log;
import com.suni.sun.ListViewActivity;
public class JsonParse extends AsyncTask<Void, Void, String> {
private Activity activity;
private String url;
private ProgressDialog dialog;
private final static String TAG = JsonParse.class.getSimpleName();
public JsonParse(Activity activity, String url)
{
super();
this.activity = activity;
this.url = url;
}
@Override
protected void onPreExecute() {
// TODO Auto-generated method stub
super.onPreExecute();
dialog = new ProgressDialog(activity);
dialog.setTitle("Getting Json Data");
dialog.setMessage("Loading");
dialog.setIndeterminate(false);
dialog.show();
}
@Override
protected String doInBackground(Void... params) {
// TODO Auto-generated method stub
return loadJSON(this.url).toString();
}
@Override
protected void onPostExecute(String result) {
// TODO Auto-generated method stub
((ListViewActivity) activity).parseJsonResponse(result);
dialog.dismiss();
Log.i(TAG, result);
}
private JSONObject loadJSON(String url) {
// TODO Auto-generated method stub
JSONGetter jParser = new JSONGetter();
JSONObject json = jParser.getJSONFromUrl(url);
return json;
}
private class JSONGetter {
private InputStream is = null;
private JSONObject jObj = null;
private String json = "";
// constructor
public JSONGetter() {
}
public JSONObject getJSONFromUrl(String url) {
// Making HTTP request
try {
// defaultHttpClient
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(url);
HttpResponse httpResponse = httpClient.execute(httpPost);
HttpEntity httpEntity = httpResponse.getEntity();
is = httpEntity.getContent();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(is, "iso-8859-1"),
8);
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line + "\n");
}
is.close();
json = sb.toString();
} catch (Exception e) {
Log.e("Buffer Error", "Error converting result " + e.toString());
}
// try parse the string to a JSON object
try {
jObj = new JSONObject(json);
} catch (JSONException e) {
Log.e("JSON Parser", "Error parsing data " + e.toString());
}
// return JSON String
return jObj;
}
}
}
customlistviewadapter
package com.suni.sun;
import java.util.List;
import com.squareup.picasso.Picasso;
import com.suni.sun.HomeGv;
import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
public class CustomListViewAdapter extends ArrayAdapter<HomeGv> {
private Activity activity;
public CustomListViewAdapter(Activity activity, int resource,
List<HomeGv> img) {
super(activity, resource, img);
this.activity = activity;
// TODO Auto-generated constructor stub
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
ViewHolder holder = null;
LayoutInflater inflater = (LayoutInflater) activity.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
if (convertView == null) {
convertView = inflater.inflate(R.layout.home_item, parent, false);
holder = new ViewHolder(convertView);
convertView.setTag(holder);
}else {
holder = (ViewHolder) convertView.getTag();
}
HomeGv thing = (HomeGv) getItem(position);
holder.title.setText(thing.getTitle());
holder.date_taken.setText(thing.getDate());
Picasso.with(activity).load(thing.getMedia()).into(holder.image);
return convertView;
}
private static class ViewHolder {
private TextView title,date_taken;
private ImageView image;
public ViewHolder(View v) {
title = (TextView) v.findViewById(R.id.grid_item_title);
date_taken = (TextView) v.findViewById(R.id.grid_item_date);
image = (ImageView) v.findViewById(R.id.grid_item_image);
}
}
}
我的家庭课程
包com.suni.sun;
public class HomeGv {
private String title;
private String media;
private String date_taken;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getMedia() {
return media;
}
public void setMedia(String m) {
this.media = m;
}
public String getDate() {
return date_taken;
}
public void setDate(String date_taken) {
this.date_taken = date_taken;
}
}
和我的网址文件
{
"title": "Recent Uploads tagged soccer",
"link": "http://www.flickr.com/photos/tags/soccer/",
"description": "",
"modified": "2015-09-28T02:59:30Z",
"generator": "http://www.flickr.com/",
"items": [
{
"title": "IMG_9207",
"link": "http://www.flickr.com/photos/sportclubsilvolde/21782884471/",
"media": {
"m": "http://farm1.staticflickr.com/681/21782884471_6834f2c9d8_m.jpg"
},
"date_taken": "2015-09-27T15:00:50-08:00",
"description": " <p><a href=\"http://www.flickr.com/people/sportclubsilvolde/\">SportclubSilvolde</a> posted a photo:</p> <p><a href=\"http://www.flickr.com/photos/sportclubsilvolde/21782884471/\" title=\"IMG_9207\"><img src=\"http://farm1.staticflickr.com/681/21782884471_6834f2c9d8_m.jpg\" width=\"240\" height=\"160\" alt=\"IMG_9207\" /></a></p> ",
"published": "2015-09-28T02:59:30Z",
"author": "nobody@flickr.com (SportclubSilvolde)",
"author_id": "124810748@N04",
"tags": "iris copyright sports soccer be quick epping voetbal 2015 1887 sportclub silvolde hoofdklasse"
},
{
"title": "IMG_9484",
"link": "http://www.flickr.com/photos/sportclubsilvolde/21747301246/",
"media": {
"m": "http://farm1.staticflickr.com/736/21747301246_f03bc953d6_m.jpg"
},
"date_taken": "2015-09-27T15:58:43-08:00",
"description": " <p><a href=\"http://www.flickr.com/people/sportclubsilvolde/\">SportclubSilvolde</a> posted a photo:</p> <p><a href=\"http://www.flickr.com/photos/sportclubsilvolde/21747301246/\" title=\"IMG_9484\"><img src=\"http://farm1.staticflickr.com/736/21747301246_f03bc953d6_m.jpg\" width=\"240\" height=\"160\" alt=\"IMG_9484\" /></a></p> ",
"published": "2015-09-28T02:59:38Z",
"author": "nobody@flickr.com (SportclubSilvolde)",
"author_id": "124810748@N04",
"tags": "iris copyright sports soccer be quick epping voetbal 2015 1887 sportclub silvolde hoofdklasse"
},
{
"title": "IMG_9135",
"link": "http://www.flickr.com/photos/sportclubsilvolde/21585600568/",
"media": {
"m": "http://farm1.staticflickr.com/588/21585600568_bce2bcd47a_m.jpg"
},
"date_taken": "2015-09-27T14:53:53-08:00",
"description": " <p><a href=\"http://www.flickr.com/people/sportclubsilvolde/\">SportclubSilvolde</a> posted a photo:</p> <p><a href=\"http://www.flickr.com/photos/sportclubsilvolde/21585600568/\" title=\"IMG_9135\"><img src=\"http://farm1.staticflickr.com/588/21585600568_bce2bcd47a_m.jpg\" width=\"240\" height=\"160\" alt=\"IMG_9135\" /></a></p> ",
"published": "2015-09-28T02:59:28Z",
"author": "nobody@flickr.com (SportclubSilvolde)",
"author_id": "124810748@N04",
"tags": "iris copyright sports soccer be quick epping voetbal 2015 1887 sportclub silvolde hoofdklasse"
},
{
"title": "IMG_9062",
"link": "http://www.flickr.com/photos/sportclubsilvolde/21761757502/",
"media": {
"m": "http://farm6.staticflickr.com/5648/21761757502_e18ee1b76f_m.jpg"
},
"date_taken": "2015-09-27T14:48:06-08:00",
"description": " <p><a href=\"http://www.flickr.com/people/sportclubsilvolde/\">SportclubSilvolde</a> posted a photo:</p> <p><a href=\"http://www.flickr.com/photos/sportclubsilvolde/21761757502/\" title=\"IMG_9062\"><img src=\"http://farm6.staticflickr.com/5648/21761757502_e18ee1b76f_m.jpg\" width=\"240\" height=\"160\" alt=\"IMG_9062\" /></a></p> ",
"published": "2015-09-28T02:59:27Z",
"author": "nobody@flickr.com (SportclubSilvolde)",
"author_id": "124810748@N04",
"tags": "iris copyright sports soccer be quick epping voetbal 2015 1887 sportclub silvolde hoofdklasse"
},
{
"title": "IMG_9718",
"link": "http://www.flickr.com/photos/sportclubsilvolde/21773428785/",
"media": {
"m": "http://farm6.staticflickr.com/5798/21773428785_256689c88f_m.jpg"
},
"date_taken": "2015-09-27T16:27:04-08:00",
"description": " <p><a href=\"http://www.flickr.com/people/sportclubsilvolde/\">SportclubSilvolde</a> posted a photo:</p> <p><a href=\"http://www.flickr.com/photos/sportclubsilvolde/21773428785/\" title=\"IMG_9718\"><img src=\"http://farm6.staticflickr.com/5798/21773428785_256689c88f_m.jpg\" width=\"240\" height=\"160\" alt=\"IMG_9718\" /></a></p> ",
"published": "2015-09-28T02:59:43Z",
"author": "nobody@flickr.com (SportclubSilvolde)",
"author_id": "124810748@N04",
"tags": "iris copyright sports soccer be quick epping voetbal 2015 1887 sportclub silvolde hoofdklasse"
},
{
"title": "IMG_9279",
"link": "http://www.flickr.com/photos/sportclubsilvolde/21761743622/",
"media": {
"m": "http://farm6.staticflickr.com/5663/21761743622_1787fff746_m.jpg"
},
"date_taken": "2015-09-27T15:15:23-08:00",
"description": " <p><a href=\"http://www.flickr.com/people/sportclubsilvolde/\">SportclubSilvolde</a> posted a photo:</p> <p><a href=\"http://www.flickr.com/photos/sportclubsilvolde/21761743622/\" title=\"IMG_9279\"><img src=\"http://farm6.staticflickr.com/5663/21761743622_1787fff746_m.jpg\" width=\"240\" height=\"160\" alt=\"IMG_9279\" /></a></p> ",
"published": "2015-09-28T02:59:34Z",
"author": "nobody@flickr.com (SportclubSilvolde)",
"author_id": "124810748@N04",
"tags": "iris copyright sports soccer be quick epping voetbal 2015 1887 sportclub silvolde hoofdklasse"
},
{
"title": "IMG_9450",
"link": "http://www.flickr.com/photos/sportclubsilvolde/21747302606/",
"media": {
"m": "http://farm1.staticflickr.com/630/21747302606_25769a18bd_m.jpg"
},
"date_taken": "2015-09-27T15:51:48-08:00",
"description": " <p><a href=\"http://www.flickr.com/people/sportclubsilvolde/\">SportclubSilvolde</a> posted a photo:</p> <p><a href=\"http://www.flickr.com/photos/sportclubsilvolde/21747302606/\" title=\"IMG_9450\"><img src=\"http://farm1.staticflickr.com/630/21747302606_25769a18bd_m.jpg\" width=\"240\" height=\"160\" alt=\"IMG_9450\" /></a></p> ",
"published": "2015-09-28T02:59:37Z",
"author": "nobody@flickr.com (SportclubSilvolde)",
"author_id": "124810748@N04",
"tags": "iris copyright sports soccer be quick epping voetbal 2015 1887 sportclub silvolde hoofdklasse"
},
{
"title": "IMG_9173",
"link": "http://www.flickr.com/photos/sportclubsilvolde/21773454925/",
"media": {
"m": "http://farm1.staticflickr.com/650/21773454925_6b011fa56b_m.jpg"
},
"date_taken": "2015-09-27T14:59:05-08:00",
"description": " <p><a href=\"http://www.flickr.com/people/sportclubsilvolde/\">SportclubSilvolde</a> posted a photo:</p> <p><a href=\"http://www.flickr.com/photos/sportclubsilvolde/21773454925/\" title=\"IMG_9173\"><img src=\"http://farm1.staticflickr.com/650/21773454925_6b011fa56b_m.jpg\" width=\"240\" height=\"160\" alt=\"IMG_9173\" /></a></p> ",
"published": "2015-09-28T02:59:28Z",
"author": "nobody@flickr.com (SportclubSilvolde)",
"author_id": "124810748@N04",
"tags": "iris copyright sports soccer be quick epping voetbal 2015 1887 sportclub silvolde hoofdklasse"
},
{
"title": "IMG_9369",
"link": "http://www.flickr.com/photos/sportclubsilvolde/21773442385/",
"media": {
"m": "http://farm6.staticflickr.com/5776/21773442385_2fe8b59342_m.jpg"
},
"date_taken": "2015-09-27T15:43:08-08:00",
"description": " <p><a href=\"http://www.flickr.com/people/sportclubsilvolde/\">SportclubSilvolde</a> posted a photo:</p> <p><a href=\"http://www.flickr.com/photos/sportclubsilvolde/21773442385/\" title=\"IMG_9369\"><img src=\"http://farm6.staticflickr.com/5776/21773442385_2fe8b59342_m.jpg\" width=\"240\" height=\"160\" alt=\"IMG_9369\" /></a></p> ",
"published": "2015-09-28T02:59:35Z",
"author": "nobody@flickr.com (SportclubSilvolde)",
"author_id": "124810748@N04",
"tags": "iris copyright sports soccer be quick epping voetbal 2015 1887 sportclub silvolde hoofdklasse"
},
{
"title": "IMG_9252",
"link": "http://www.flickr.com/photos/sportclubsilvolde/21773446605/",
"media": {
"m": "http://farm6.staticflickr.com/5803/21773446605_f7a06e7e36_m.jpg"
},
"date_taken": "2015-09-27T15:08:46-08:00",
"description": " <p><a href=\"http://www.flickr.com/people/sportclubsilvolde/\">SportclubSilvolde</a> posted a photo:</p> <p><a href=\"http://www.flickr.com/photos/sportclubsilvolde/21773446605/\" title=\"IMG_9252\"><img src=\"http://farm6.staticflickr.com/5803/21773446605_f7a06e7e36_m.jpg\" width=\"240\" height=\"160\" alt=\"IMG_9252\" /></a></p> ",
"published": "2015-09-28T02:59:33Z",
"author": "nobody@flickr.com (SportclubSilvolde)",
"author_id": "124810748@N04",
"tags": "iris copyright sports soccer be quick epping voetbal 2015 1887 sportclub silvolde hoofdklasse"
},
{
"title": "IMG_9338",
"link": "http://www.flickr.com/photos/sportclubsilvolde/21585421430/",
"media": {
"m": "http://farm1.staticflickr.com/678/21585421430_990728e31c_m.jpg"
},
"date_taken": "2015-09-27T15:21:18-08:00",
"description": " <p><a href=\"http://www.flickr.com/people/sportclubsilvolde/\">SportclubSilvolde</a> posted a photo:</p> <p><a href=\"http://www.flickr.com/photos/sportclubsilvolde/21585421430/\" title=\"IMG_9338\"><img src=\"http://farm1.staticflickr.com/678/21585421430_990728e31c_m.jpg\" width=\"240\" height=\"160\" alt=\"IMG_9338\" /></a></p> ",
"published": "2015-09-28T02:59:35Z",
"author": "nobody@flickr.com (SportclubSilvolde)",
"author_id": "124810748@N04",
"tags": "iris copyright sports soccer be quick epping voetbal 2015 1887 sportclub silvolde hoofdklasse"
},
{
"title": "IMG_9186",
"link": "http://www.flickr.com/photos/sportclubsilvolde/21747317326/",
"media": {
"m": "http://farm1.staticflickr.com/655/21747317326_09db2d4bc4_m.jpg"
},
"date_taken": "2015-09-27T15:00:37-08:00",
"description": " <p><a href=\"http://www.flickr.com/people/sportclubsilvolde/\">SportclubSilvolde</a> posted a photo:</p> <p><a href=\"http://www.flickr.com/photos/sportclubsilvolde/21747317326/\" title=\"IMG_9186\"><img src=\"http://farm1.staticflickr.com/655/21747317326_09db2d4bc4_m.jpg\" width=\"240\" height=\"160\" alt=\"IMG_9186\" /></a></p> ",
"published": "2015-09-28T02:59:29Z",
"author": "nobody@flickr.com (SportclubSilvolde)",
"author_id": "124810748@N04",
"tags": "iris copyright sports soccer be quick epping voetbal 2015 1887 sportclub silvolde hoofdklasse"
},
{
"title": "IMG_9366",
"link": "http://www.flickr.com/photos/sportclubsilvolde/21761741452/",
"media": {
"m": "http://farm6.staticflickr.com/5691/21761741452_64bf400d37_m.jpg"
},
"date_taken": "2015-09-27T15:43:07-08:00",
"description": " <p><a href=\"http://www.flickr.com/people/sportclubsilvolde/\">SportclubSilvolde</a> posted a photo:</p> <p><a href=\"http://www.flickr.com/photos/sportclubsilvolde/21761741452/\" title=\"IMG_9366\"><img src=\"http://farm6.staticflickr.com/5691/21761741452_64bf400d37_m.jpg\" width=\"240\" height=\"160\" alt=\"IMG_9366\" /></a></p> ",
"published": "2015-09-28T02:59:35Z",
"author": "nobody@flickr.com (SportclubSilvolde)",
"author_id": "124810748@N04",
"tags": "iris copyright sports soccer be quick epping voetbal 2015 1887 sportclub silvolde hoofdklasse"
},
{
"title": "IMG_9193",
"link": "http://www.flickr.com/photos/sportclubsilvolde/21152397043/",
"media": {
"m": "http://farm1.staticflickr.com/667/21152397043_119c967606_m.jpg"
},
"date_taken": "2015-09-27T15:00:38-08:00",
"description": " <p><a href=\"http://www.flickr.com/people/sportclubsilvolde/\">SportclubSilvolde</a> posted a photo:</p> <p><a href=\"http://www.flickr.com/photos/sportclubsilvolde/21152397043/\" title=\"IMG_9193\"><img src=\"http://farm1.staticflickr.com/667/21152397043_119c967606_m.jpg\" width=\"240\" height=\"160\" alt=\"IMG_9193\" /></a></p> ",
"published": "2015-09-28T02:59:30Z",
"author": "nobody@flickr.com (SportclubSilvolde)",
"author_id": "124810748@N04",
"tags": "iris copyright sports soccer be quick epping voetbal 2015 1887 sportclub silvolde hoofdklasse"
},
{
"title": "IMG_9031",
"link": "http://www.flickr.com/photos/sportclubsilvolde/21585604338/",
"media": {
"m": "http://farm6.staticflickr.com/5759/21585604338_75455ba520_m.jpg"
},
"date_taken": "2015-09-27T14:42:39-08:00",
"description": " <p><a href=\"http://www.flickr.com/people/sportclubsilvolde/\">SportclubSilvolde</a> posted a photo:</p> <p><a href=\"http://www.flickr.com/photos/sportclubsilvolde/21585604338/\" title=\"IMG_9031\"><img src=\"http://farm6.staticflickr.com/5759/21585604338_75455ba520_m.jpg\" width=\"240\" height=\"160\" alt=\"IMG_9031\" /></a></p> ",
"published": "2015-09-28T02:59:27Z",
"author": "nobody@flickr.com (SportclubSilvolde)",
"author_id": "124810748@N04",
"tags": "iris copyright sports soccer be quick epping voetbal 2015 1887 sportclub silvolde hoofdklasse"
},
{
"title": "IMG_9103",
"link": "http://www.flickr.com/photos/sportclubsilvolde/21585435240/",
"media": {
"m": "http://farm1.staticflickr.com/663/21585435240_a5757ed8fd_m.jpg"
},
"date_taken": "2015-09-27T14:49:37-08:00",
"description": " <p><a href=\"http://www.flickr.com/people/sportclubsilvolde/\">SportclubSilvolde</a> posted a photo:</p> <p><a href=\"http://www.flickr.com/photos/sportclubsilvolde/21585435240/\" title=\"IMG_9103\"><img src=\"http://farm1.staticflickr.com/663/21585435240_a5757ed8fd_m.jpg\" width=\"240\" height=\"160\" alt=\"IMG_9103\" /></a></p> ",
"published": "2015-09-28T02:59:28Z",
"author": "nobody@flickr.com (SportclubSilvolde)",
"author_id": "124810748@N04",
"tags": "iris copyright sports soccer be quick epping voetbal 2015 1887 sportclub silvolde hoofdklasse"
},
},
}
]
}
我的logcat
10-05 10:11:19.821: E/AndroidRuntime(1731): java.lang.NoClassDefFoundError: com.squareup.picasso.Picasso
10-05 10:11:19.821: E/AndroidRuntime(1731): at com.suni.sun.CustomListViewAdapter.getView(CustomListViewAdapter.java:46)
10-05 10:11:19.821: E/AndroidRuntime(1731): at android.widget.AbsListView.obtainView(AbsListView.java:2159)
10-05 10:11:19.821: E/AndroidRuntime(1731): at android.widget.ListView.measureHeightOfChildren(ListView.java:1246)
10-05 10:11:19.821: E/AndroidRuntime(1731): at android.widget.ListView.onMeasure(ListView.java:1158)
10-05 10:11:19.821: E/AndroidRuntime(1731): at android.view.View.measure(View.java:15518)
10-05 10:11:19.821: E/AndroidRuntime(1731): at android.widget.RelativeLayout.measureChild(RelativeLayout.java:666)
10-05 10:11:19.821: E/AndroidRuntime(1731): at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:477)
10-05 10:11:19.821: E/AndroidRuntime(1731): at android.view.View.measure(View.java:15518)
10-05 10:11:19.821: E/AndroidRuntime(1731): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
答案 0 :(得分:2)
您忘记将此行添加到build.properties文件
compile 'com.squareup.picasso:picasso:2.5.2'
如Picasso documentation中所述,这是使您的项目能够使用库/
的原因答案 1 :(得分:0)
如果您使用gradle将此行添加到依赖项
下的build.gradlecompile 'com.squareup.picasso:picasso:2.5.2'
否则从maven central ot jcenter
下载jar