I can not generate the android APK

2

When I try to generate my apk in Android Studio , I get the following error:

  

Error: Error: Found byte-order-mark in the middle of a file [ByteOrderMark]

My app only has a webview with a link to a web.

public class MainActivity extends AppCompatActivity {

    private WebView mWebView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mWebView = (WebView) findViewById(R.id.webview);
        // Activamos Javascript
        WebSettings webSettings = mWebView.getSettings();
        webSettings.setJavaScriptEnabled(true);
        mWebView.setWebViewClient(new WebViewClient());
        // Url que carga la app (webview)
        // mWebView.setWebChromeClient(new WebChromeClient());
        //mWebView.setWebViewClient(new WebViewClient());
        mWebView.loadUrl("http://mypage.com/login.php");

    }
}

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.myapp.MainActivity">

    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="#00f">

        <LinearLayout
            android:layout_width="368dp"
            android:layout_height="495dp"
            android:orientation="vertical"
            tools:layout_editor_absoluteX="8dp"
            tools:layout_editor_absoluteY="8dp">

            <WebView
                android:id="@+id/webview"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />
        </LinearLayout>

    </ScrollView>

</android.support.constraint.ConstraintLayout>
    
asked by Strelok 03.04.2017 в 21:44
source

1 answer

0

You have a unicode character \uFEFF in some .xml file even it could be AndroidManifest.xml .

To solve this within Android Studio go to the option to change the encoding of the file containing the problem, select utf-16 and select the option "Convert":

Subsequently applies the same procedure but converting to UTF-8.

As another option you could copy the contents of the file inside notepad and then paste it to Android Studio, saving your file.

    
answered by 03.04.2017 в 23:16