请帮助我如何在关于触觉的\about中解决这个问题。java
行中:
imageLoader.DisplayImage(Constant.SERVER_IMAGE_NEWSLISTDETAILS+about.getComLogo().toString(), imglogo);
消息gradle Builder中的问题:
错误:错误:类型字符串的预期资源[ResourceType]
package com.freeimages.hdpicturs;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import com.hdpictursfree.imageloader.ImageLoader;
import com.hdpictursfree.item.ItemAbout;
import com.hdpictursfree.util.AlertDialogManager;
import com.hdpictursfree.util.Constant;
import com.hdpictursfree.util.JsonUtils;
import android.app.ProgressDialog;
import android.graphics.Color;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
public class AboutActivity extends ActionBarActivity {
ImageView imglogo;
TextView txtappname,txtcomemail,txtcomsite;
WebView webcomdes;
public ImageLoader imageLoader;
JsonUtils util;
List<ItemAbout> listabout;
AlertDialogManager alert = new AlertDialogManager();
Toolbar toolbar;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.about);
toolbar = (Toolbar) this.findViewById(R.id.toolbar);
toolbar.setTitle("About Us");
this.setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
imglogo=(ImageView)findViewById(R.id.image_comlogo);
txtappname=(TextView)findViewById(R.id.text_appname);
txtcomemail=(TextView)findViewById(R.id.text_comemail);
txtcomsite=(TextView)findViewById(R.id.text_comwebsite);
webcomdes=(WebView)findViewById(R.id.webView_comdes);
webcomdes.getSettings().setDefaultTextEncodingName("UTF-8");
listabout=new ArrayList<ItemAbout>();
imageLoader=new ImageLoader(getApplicationContext());
util=new JsonUtils(getApplicationContext());
if (JsonUtils.isNetworkAvailable(AboutActivity.this)) {
new MyTask().execute(Constant.COMPANY_DETAILS_URL);
} else {
showToast("No Network Connection!!!");
alert.showAlertDialog(AboutActivity.this, "Internet Connection Error",
"Please connect to working Internet connection", false);
}
}
private class MyTask extends AsyncTask<String, Void, String> {
ProgressDialog pDialog;
@Override
protected void onPreExecute() {
super.onPreExecute();
pDialog = new ProgressDialog(AboutActivity.this);
pDialog.setMessage("Loading...");
pDialog.setCancelable(false);
pDialog.show();
}
@Override
protected String doInBackground(String... params) {
return JsonUtils.getJSONString(params[0]);
}
@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);
if (null != pDialog && pDialog.isShowing()) {
pDialog.dismiss();
}
if (null == result || result.length() == 0) {
showToast("Server Connection Error");
alert.showAlertDialog(AboutActivity.this, "Server Connection Error",
"May Server Under Maintaines Or Low Network", false);
} else {
try {
JSONObject mainJson = new JSONObject(result);
JSONArray jsonArray = mainJson.getJSONArray(Constant.CATEGORY_ARRAY_NAME);
JSONObject objJson = null;
for (int i = 0; i < jsonArray.length(); i++) {
objJson = jsonArray.getJSONObject(i);
ItemAbout objItem = new ItemAbout();
objItem.setAppName(objJson.getString(Constant.COMPANY_DETAILS_APPNAME));
objItem.setComEmail(objJson.getString(Constant.COMPANY_DETAILS_COMMAIL));
objItem.setComWebsite(objJson.getString(Constant.COMPANY_DETAILS_COMSITE));
objItem.setComDes(objJson.getString(Constant.COMPANY_DETAILS_COMDES));
objItem.setComLogo(objJson.getString(Constant.COMPANY_DETAILS_COMLOGO));
listabout.add(objItem);
}
} catch (JSONException e) {
e.printStackTrace();
}
setAdapterToListview();
}
}
}
public void setAdapterToListview() {
ItemAbout about=listabout.get(0);
txtappname.setText(about.getAppName());
txtcomemail.setText(about.getComEmail());
txtcomsite.setText(about.getComWebsite());
String mimeType = "text/html";
String encoding = "utf-8";
String htmlText = about.getComDes();
String text = "<html><head>"
+ "<style type=\"text/css\">body{color: #1C1C1C;}"
+ "</style></head>"
+ "<body>"
+ htmlText
+ "</body></html>";
webcomdes.loadData(text, mimeType, encoding);
webcomdes.setBackgroundColor(Color.parseColor(getString(R.color.background_color)));
imageLoader.DisplayImage(Constant.SERVER_IMAGE_NEWSLISTDETAILS+about.getComLogo().toString(), imglogo);
}
public void showToast(String msg) {
Toast.makeText(AboutActivity.this, msg, Toast.LENGTH_LONG).show();
}
@Override
public boolean onOptionsItemSelected(MenuItem menuItem)
{
switch (menuItem.getItemId())
{
case android.R.id.home:
onBackPressed();
break;
default:
return super.onOptionsItemSelected(menuItem);
}
return true;
}
}
该项目运行良好,但当我尝试生成签名APK时,它显示了一个错误:错误:在Main活动中,预期资源类型为可绘制[ResourceType]: 当您点击按钮时,应用程序会显示图像并播放声音。问题是为什么在声音的情况下一切都好,但这里有一个错误: 我很感激任何帮助
我有这个问题,当我生成签名apk: F:\。。。\app\src\main\java\com\palletdesign\clipdooni\Activity\u VideoPlay。java错误:错误:类型为字符串[ResourceType]的预期资源 这是活动视频游戏。java(这部分代码的错误):
在android studio中,当我想要生成签名apk时,会导致以下错误:
在android studio中,当我想要生成签名apk时,会导致以下错误:
我刚刚尝试为我的一个项目生成已签名的apk(我以前已经这样做了),但是(可能是在更新Android Studio之后)我得到了一些支持 错误:错误:类型字符串的预期资源[ResourceType] 这是因为我使用的是Butterknife的@BindString,它被生成为类似的东西 我怎么能让工作室没有检测到这是错误?我试过在设置中搜索,但没有成功。
请看一下这段代码。最后一行出现了一个错误,因为我传递的是一个“索引”而不是一个资源。我以为是皮毛的问题,试图压制它。然后我注意到只有在构建发布时才会出现这个错误。它在构建调试时工作良好。我完全一无所知。谁能告诉我我做错了什么。