【发布时间】:2023-04-10 15:51:02
【问题描述】:
我现在真的很沮丧。我试图向操作栏添加一个按钮,但又被删除了,因为我认为它导致了这个原因。以下是 Gradle 错误消息
Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72200Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42200Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources
Error:Content ist nicht zulässig in Prolog.
:app:mergeDebugResources FAILED
D:\SkyDrive\Android Apps\Boerse\app\src\main\res\libs\androidplot-core- 0.6.2-SNAPSHOT-sources.jar
Error:Error: Content ist nicht zulässig in Prolog.
Error:Execution failed for task ':app:mergeDebugResources'.
> D:\SkyDrive\Android Apps\Boerse\app\src\main\res\libs\androidplot-core- 0.6.2-SNAPSHOT-sources.jar:0:0: Error: Content ist nicht zulässig in Prolog.
Information:BUILD FAILED
Information:Total time: 15.295 secs
Information:3 errors
Information:0 warnings
Information:See complete output in console
我已经尝试了各种论坛的多种解决方案,但无法正常工作。我经常读到其中一个 jar 库会导致问题,并且由于错误消息中显示了 androidplot 库,我认为它就是那个。但即使在将其注释掉之后,错误也没有消失。之前确实运行良好。
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "ccag.boerse"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'commons-io:commons-io:+'
compile "org.jsoup:jsoup:1.8.1"
compile "com.androidplot:androidplot-core:0.6.1"}
我只在一个类中使用 androidplot 库并在那里使用它。以下是类:
package ccag.boerse;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;
import com.androidplot.ui.AnchorPosition;
import com.androidplot.ui.XLayoutStyle;
import com.androidplot.ui.YLayoutStyle;
import com.androidplot.xy.XYPlot;
import java.text.SimpleDateFormat;
public class DetailView extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail_view);
Depot depot = MainActivity.depot;
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setTitle(depot.temporary.getBezeichnung());
TextView WKN_Value = (TextView) findViewById(R.id.WKN_Value);
TextView Current_Value = (TextView) findViewById(R.id.Current_Value);
XYPlot chart = (com.androidplot.xy.XYPlot) findViewById(R.id.chart);
WKN_Value.setText(depot.temporary.getWKN());
Current_Value.setText(String.valueOf(depot.temporary.getCurrentValue()));
depot.temporary.Update_Average();
chart.addSeries(depot.temporary.getHistory_as_Series(), depot.temporary.getHistory_Format());
chart.addSeries(depot.temporary.getAverage1_as_Series(), depot.temporary.getAverage1_Format());
chart.addSeries(depot.temporary.getAverage2_as_Series(), depot.temporary.getAverage2_Format());
chart.setDomainValueFormat(new SimpleDateFormat("MM-yy"));
chart.getGraphWidget().getDomainLabelPaint().setTextSize(20);
chart.getGraphWidget().getRangeLabelPaint().setTextSize(20);
chart.getLegendWidget().getTextPaint().setTextSize(20);
chart.getLegendWidget().position(125, XLayoutStyle.ABSOLUTE_FROM_RIGHT, 100, YLayoutStyle.ABSOLUTE_FROM_BOTTOM, AnchorPosition.RIGHT_BOTTOM);
chart.getGraphWidget().setMarginLeft(20);
chart.getGraphWidget().setMarginBottom(25);
chart.redraw();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_detail_view, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}}
我从 gradle 文件中注释掉了每个库,但错误仍然相同。如果您需要更多代码,请告诉我。
非常感谢您提前
【问题讨论】:
-
英文我的朋友
-
对不起,我会用英文添加它
-
完成,现在一切都是英文的
-
你能用
--stacktrace运行gradle吗?