问题
I am developing Android app which uploads images to Picasa but while authentication i am getting an ClassnotfoundException
and some time Unable to execute dex: Java heap space
all Gdata jar files are in Lib folder which includes Guava-11.0.2 file.
Note: I am verifying the application on Android Emulator.
package com.example.temp;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ListView;
import com.google.gdata.client.*;
import com.google.gdata.client.photos.*;
import com.google.gdata.data.*;
import com.google.gdata.data.media.*;
import com.google.gdata.data.photos.*;
import com.google.gdata.util.AuthenticationException;
public class Temp extends Activity implements OnClickListener {
Button oButton;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_temp);
oButton = (Button) findViewById(R.id.btnok);
oButton.setOnClickListener(this);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_temp, menu);
return true;
}
public void onClick(View arg0) {
// TODO Auto-generated method stub
PicasawebService oPicasaWebService = new PicasawebService("example");
try {
oPicasaWebService.setUserCredentials("ashishmchauhan@gmail.com", "qualis");
} catch (AuthenticationException e) {
// TODO Auto-generated catch block
Log.d("Temp",e.getMessage());
e.printStackTrace();
}
}
}
来源:https://stackoverflow.com/questions/12418750/upload-image-to-picasa-using-picasawebservice-in-android