我现在真的很沮丧。我试图将一个Button添加到Action Bar但是再次删除,因为我认为它导致了这个原因。以下是Gradle Error Messages
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 lib显示在错误消息中,我认为它就是那个。但即使在评论之后,错误也没有消失。它实际上工作得很好。
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文件中注释掉了每个库,但错误仍然相同。如果您需要更多代码,请告诉我。
非常感谢你提前
答案 0 :(得分:2)
您放错了JAR文件。它们不应该在res
之下。资源编译器尝试将它们解析为XML并失败,因此出现错误消息。
由于你正在使用repo中的android-plot库,你可以完全删除res/libs
。
答案 1 :(得分:0)
问题很可能是您AndroidManifest.xml
的无效内容。检查它是否是有效的XML。我不确定构建是否在那里进行一些转换/替换,但通常它必须是符合Android应用程序要求的有效XML。
类似的主题很少,例如org.xml.sax.SAXParseException: Content is not allowed in prolog或Java parsing XML document gives "Content not allowed in prolog." error