-1

I am really getting Frustrated right now. I tried to add a Button to the Action Bar but removed again because i thought it caused this reason. The following is the 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

I already tried multiple solutions from various forums but could not get it to work. I often read that one of the jar libs causes the problem and since the androidplot lib is shown in the error messages i thought that its that one. But even after commenting it out the errror did not disappear. It actually worked fine before.

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"}

I only use the androidplot library in one class and use it there. the following is the class:

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);
}}

I commented every library out from the gradle file but the error is still the same. If you need more code please let me know.

Thank you very much in Advance

Bart Kiers
  • 166,582
  • 36
  • 299
  • 288

2 Answers2

2

You have misplaced your JAR files. They should not be under res. The resource compiler tries to parse them as XML and fails, hence the error message.

Since you're using the android-plot library from a repo, you can remove the res/libs altogether.

laalto
  • 150,114
  • 66
  • 286
  • 303
0

The problem is most likely an invalid content of your AndroidManifest.xml. Check if it is valid XML. I am not sure if build is doing some transformation/substitutions there but generally it has to be a valid XML conforming to Android app requirements.

There are few similar topics like org.xml.sax.SAXParseException: Content is not allowed in prolog or Java parsing XML document gives "Content not allowed in prolog." error

Community
  • 1
  • 1
Radim
  • 4,721
  • 1
  • 22
  • 25