gpt4 book ai didi

安卓编译错误

转载 作者:行者123 更新时间:2023-11-29 17:52:59 25 4
gpt4 key购买 nike

我有一个安卓应用程序。我在编译时遇到了一些问题。那么问题出在哪里。请帮我。抱歉我的英语不好。

这里是错误:

Information:Using javac 1.6.0_65 to compile java sources
Information:java: Errors occurred while compiling module 'cycle4it_android'
Information:Compilation completed with 1 error and 6 warnings in 2 sec
Information:1 error
Information:6 warnings
Warning:java: Note: /Users/m/Projects/navico/mobile/android/cycle4it_android/src/com/cubicasa/cycle4it/DonateActivity.java uses unchecked or unsafe operations.
Warning:java: Note: Recompile with -Xlint:unchecked for details.
/Users/m/Projects/navico/mobile/android/cycle4it_android/src/com/cubicasa/cycle4it/DonateActivity.java
Warning:Warning:line (417)java: /Users/m/Projects/navico/mobile/android/cycle4it_android/src/com/cubicasa/cycle4it/DonateActivity.java:417: warning: [deprecation] Notification(int,java.lang.CharSequence,long) in android.app.Notification has been deprecated
Warning:Warning:line (419)java: /Users/m/Projects/navico/mobile/android/cycle4it_android/src/com/cubicasa/cycle4it/DonateActivity.java:419: warning: [deprecation] setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent) in android.app.Notification has been deprecated
/Users/m/Projects/navico/mobile/android/cycle4it_android/src/com/cubicasa/cycle4it/SignupActivity.java
Error:Error:line (28)java: /Users/m/Projects/navico/mobile/android/cycle4it_android/src/com/cubicasa/cycle4it/SignupActivity.java:28: cannot find symbol
symbol : method setPluginsEnabled(boolean)
location: class android.webkit.WebSettings
/Users/m/Projects/navico/mobile/android/cycle4it_android/src/com/cubicasa/cycle4it/SubmitActivity.java
Warning:Warning:line (106)java: /Users/m/Projects/navico/mobile/android/cycle4it_android/src/com/cubicasa/cycle4it/SubmitActivity.java:106: warning: [deprecation] Notification(int,java.lang.CharSequence,long) in android.app.Notification has been deprecated
Warning:Warning:line (107)java: /Users/m/Projects/navico/mobile/android/cycle4it_android/src/com/cubicasa/cycle4it/SubmitActivity.java:107: warning: [deprecation] setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent) in android.app.Notification has been deprecated

这是我的注册 Activity :

public class SignupActivity extends Activity {
WebView webview;

@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.sign_up);

webview = (WebView) findViewById(R.id.webView1);
webview.getSettings().setJavaScriptEnabled(true);

webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setLoadWithOverviewMode(true);
webview.getSettings().setUseWideViewPort(true);
webview.getSettings().setBuiltInZoomControls(true);
webview.getSettings().setPluginsEnabled(true);
webview.loadUrl("http://beta.cycle4it.com/register");

}

这是我的提交 Activity :

public class SubmitActivity extends Activity implements OnClickListener {

TextView distance, userid, purpose, email, type;
Button submit;
NotificationManager nm;
static final int uniqueId=12;

@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.submit);
new CreateUser().execute();
submit = (Button) findViewById(R.id.submit);
distance = (TextView) findViewById(R.id.distance);
userid = (TextView) findViewById(R.id.usrid);
String distanceink = String.valueOf(Constant.totalDistanceinKm);
String userId = Constant.idusr;
distance.setText(distanceink);
userid.setText(userId);
nm=(NotificationManager)getSystemService(NOTIFICATION_SERVICE);
nm.cancel(uniqueId);
submit.setOnClickListener(this);

}

class CreateUser extends AsyncTask<String, String, String> {

@Override
protected String doInBackground(String... args) {
// TODO Auto-generated method stub
// Check for success tag
String distanceink = String.valueOf(Constant.totalDistanceinKm);
String useridc = String.valueOf(Constant.idusr);

HttpClient client = new DefaultHttpClient();

String url = "http://......./api/POST/donate/data";
HttpPost httppost = new HttpPost(url);
// httppost.setHeader("Content-type", "application/json");
// httppost.setHeader("Accept", "application/json");

try {
List<NameValuePair> namevalpair = new ArrayList<NameValuePair>();
namevalpair.add(new BasicNameValuePair("km", distanceink));
namevalpair.add(new BasicNameValuePair("id", useridc));
namevalpair.add(new BasicNameValuePair("purpose", "1"));
namevalpair.add(new BasicNameValuePair("email",
"moudud.hassan@cubicasa.fi"));
namevalpair.add(new BasicNameValuePair("type", "1"));
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(
namevalpair, HTTP.UTF_8);
httppost.setEntity(entity);

HttpResponse httpresponse = client.execute(httppost);
int responsecode = httpresponse.getStatusLine().getStatusCode();
Log.d("responsenummmm", "submit" + responsecode);
// Log.d("httpresponseeeee", httpresponse.toString());
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
}

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent = new Intent(this, NotificationActivity.class);
PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0);
String body="Good job: "+Constant.distance+" biked so";
String title="Cycle4it";
Notification n = new Notification(R.drawable.nf, body, System.currentTimeMillis());
n.setLatestEventInfo(this, title, body, pIntent);
n.defaults=Notification.DEFAULT_ALL;
nm.notify(uniqueId, n);
this.finish();
}

}

最佳答案

尝试替换这段代码

webview.getSettings().setPluginsEnabled(true)

webview.getSettings().setPluginState(WebSettings.PluginState.ON);

关于安卓编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21669973/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com