Ошибка синхронизации c и ОШИБКА: не удалось проанализировать XML в - PullRequest
1 голос
/ 01 февраля 2020

У меня ошибка с Gradle. Я попытался перезагрузить компьютер и программу, но ничего не изменилось. у меня та же ошибка: ParseError at [row,col]:[17,9] Message: expected start or end tag

Я пытался найти что-то ненормальное в строке 17, но для меня все нормально. В файле build.gradle, когда я щелкаю по некоторым строкам, он предлагает какую-то новую версию, поэтому обычно все обновляется.

Я также заглянул на этот сайт, чтобы найти, может ли он решить мою проблему, но это не помогло. СБОЙ: Сбой сборки Gradle за исключением

build.gradle app

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.example.myapplication"
        minSdkVersion 18
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'com.google.android.gms:play-services-ads:18.2.0'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'com.google.ads.mediation:facebook:5.5.0.0'
    implementation 'com.google.android.gms:play-services-ads:11.4.2'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.appcompat:appcompat:1.0.2'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'


}

информация о build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'


    }

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }


allprojects {
    repositories {
        google()
        jcenter()
        maven{
            url "https://maven.google.com"
        }

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

код xml, это может помочь вам

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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=".MainActivity">



    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
        <com.google.android.gms.ads.AdView
            android:id="@+id/adView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:adSize="BANNER"
            app:adUnitId="ca-app-pub-2945227826409900/1799805283"></com.google.android.gms.ads.AdView>

        <TableRow
            android:layout_width="match_parent"
            android:layout_height="96dp">

            <ScrollView
                android:layout_width="match_parent"
                android:layout_height="match_parent">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical">

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:orientation="vertical">

                        <TableRow
                            android:layout_width="match_parent"
                            android:layout_height="match_parent">

                            <EditText
                                android:id="@+id/editText"
                                android:layout_width="wrap_content"
                                android:layout_height="99dp"
                                android:ems="10"
                                android:inputType="textPersonName" />

                            <Button
                                android:id="@+id/button3"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="search" />

                            <ProgressBar
                                android:id="@+id/progressBar"
                                style="?android:attr/progressBarStyle"
                                android:layout_width="102dp"
                                android:layout_height="83dp" />

                        </TableRow>

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:orientation="horizontal">

                            <EditText
                                android:id="@+id/editText2"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:ems="10"
                                android:inputType="textPersonName"
                                android:text="add some text" />

                            <Button
                                android:id="@+id/button_send"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_weight="1"
                                android:text="Send" />
                        </LinearLayout>

                    </LinearLayout>

                </LinearLayout>
            </ScrollView>

            <androidx.constraintlayout.widget.Guideline
                android:id="@+id/guideline2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical" />

        </TableRow>


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

        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/textView4"
                    android:layout_width="432dp"
                    android:layout_height="531dp"
                    android:text="TextView" />

            </LinearLayout>
        </ScrollView>


    </LinearLayout>


</androidx.constraintlayout.widget.ConstraintLayout>

android манифест

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.info">
    <uses-permission android:name="android.permission.INTERNET"></uses-permission>
    <uses-permission android:name="android.permission.BLUETOOTH"></uses-permission>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        android:launchMode="singleInstance"
        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-2945227826409900~3138961208"/>
        <activity android:name=".MainActivity">

            <intent-filter>

                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

1 Ответ

0 голосов
/ 01 февраля 2020

Как видно в вашем AndroidManifest.xml коде, следующая строка android:launchMode="singleInstance" отсутствует ни в одном теге

удалите ее, и тогда ошибка исчезнет

ваш AndroidManifest.xml должен выглядеть следующим образом

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.info">
    <uses-permission android:name="android.permission.INTERNET"></uses-permission>
    <uses-permission android:name="android.permission.BLUETOOTH"></uses-permission>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-2945227826409900~3138961208"/>
        <activity android:name=".MainActivity">

            <intent-filter>

                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

Дополнительно: - конфигурация режима запуска android:launchMode="singleInstance" применяется к действию

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...