草庐IT

android - 错误 :(72) unknown element <receiver> found

coder 2023-11-19 原文

我正在使用 Dji-SDK。最近我将 SDK 从 4.2 版迁移到 4.3.2 版。更改 libs 文件夹中的 dji-sdk.aar 后,由于 list 中的合并问题,我无法构建。构建中的合并 list 如下创建。

...
<uses-permission android:name="android.permission.USE_CREDENTIALS" />

    <receiver
        android:name="dji.logic.receiver.DJIPilotStartupReceiver"
        android:exported="true"
        android:permission="dji.permission.sdk.wifi" >
        <intent-filter>
            <action android:name="dji.pilot.STARTUP" />
            <action android:name="dji.go3.STARTUP" />
            <action android:name="dji.go4.STARTUP" />
        </intent-filter>
    </receiver>

    <application
        android:name="com.sample.app.LinkApplication"
...

我知道 receiver 标签应该在 application 标签下。但在合并的 list 中,标签位于 uses-permission 标签下并显示错误。是 Sdk 错误还是我这边的错误? 错误是

Error:(71) unknown element <receiver> found

这是 build.gradle。

    buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.getkeepsafe.dexcount'
apply plugin: 'me.tatarka.retrolambda'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.sample.app"
        minSdkVersion 21
        targetSdkVersion 25
        versionCode 7
        versionName "4.0.2"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        externalNativeBuild {
            cmake {
                cppFlags "-std=c++11"
            }
        }
        vectorDrawables {
            useSupportLibrary = true
        }
        packagingOptions {
            exclude 'META-INF/rxjava.properties'
        }
        multiDexEnabled true
        retrolambda {
            javaVersion JavaVersion.VERSION_1_6
            incremental true
        }
        buildConfigField "boolean", "DRONE_DEBUG", property('DRONE_DEBUG')
        buildConfigField "String", "BASE_URL", property('BASE_URL')
        buildConfigField "String", "LINK_DRONE_URL", property('LINK_DRONE_URL')
        buildConfigField "String", "LINK_SENSOR_URL", property('LINK_SENSOR_URL')
        resValue "string", "api_key_dji_sdk", "################"
        resValue "string", "app_name", "Link"
        dimension "default"
        applicationId = "com.sample.app"
    }
    buildTypes {
        debug {

        }
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    flavorDimensions "default"
    lintOptions {
        checkReleaseBuilds false
    }
    dataBinding {
        enabled = true
    }
    externalNativeBuild {
        cmake {
            path "CMakeLists.txt"
        }
    }
    compileOptions {
        targetCompatibility 1.8
        sourceCompatibility 1.8
    }
}

repositories {
    flatDir {
        dirs 'libs'
    }
    maven { url 'https://maven.fabric.io/public' }

}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    testImplementation 'junit:junit:4.12'
    testImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
    debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5'
    releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
    implementation 'com.android.support:appcompat-v7:25.4.0'
    implementation 'com.android.support:design:25.4.0'
    implementation 'com.android.support:cardview-v7:25.4.0'
    implementation 'com.android.support:multidex:1.0.2'
    implementation 'com.google.android.gms:play-services-location:11.0.2'
    implementation 'com.google.android.gms:play-services-maps:11.0.2'
    implementation 'com.google.dagger:dagger:2.10'
    annotationProcessor 'com.google.dagger:dagger-compiler:2.10'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
    implementation 'com.jakewharton.rxbinding2:rxbinding:2.0.0'
    implementation 'io.reactivex.rxjava2:rxjava:2.1.1'
    implementation('com.squareup.retrofit2:retrofit:2.3.0')
    implementation('com.squareup.retrofit2:converter-gson:2.3.0') {
        exclude group: 'com.google.code.gson', module: 'gson'
    }
    implementation 'com.squareup.retrofit2:converter-scalars:2.1.0'
    implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.8.1'
    implementation 'com.jakewharton.timber:timber:4.5.1'
    implementation 'me.grantland:autofittextview:0.2.1'
    implementation 'com.squareup:otto:1.3.8'
    implementation('org.jscience:jscience:4.3.1', {
        exclude group: 'org.javolution', module: 'javolution'
    })
    //implementation 'com.dji:dji-sdk:4.3.2' (i have tried this too after removeing the dji-sdk.aar)
    implementation('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
        transitive = true;
    }
}

我正在使用

  • Android Studio 3.0 测试版 4
  • Dji-sdk 4.3.2

最佳答案

尝试通过将 android.enableAapt2=false 添加到您的 gradle.properties 文件来禁用 AAPT2

Builds may fail while AAPT2 is enabled. Additionally, AAPT2 is currently not compatible with Robelectric. If your build fails due to an AAPT2 resource processing issue or you want to use Roboelectric, you can disable AAPT2 by setting android.enableAapt2=false in your gradle.properties file and restarting the Gradle daemon by running ./gradlew --stop from the command line.

引用:here

我使用的是 Android studio 3.0 beta 5,其中我禁用了 AAPT2,它解决了我的错误。

更新:

作为Jay已经提到另一个解决方案可以将 Android Studio 更新到 3.1.1。由于更新已经为他解决了问题。不过我还没有交叉检查。

更新:2020 年 3 月 1 日 作为Tarit已经提到,android.enableAapt2=false 已弃用,不应使用。

关于android - 错误 :(72) unknown element <receiver> found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46560449/

有关android - 错误 :(72) unknown element <receiver> found的更多相关文章

  1. ruby-on-rails - Rails 常用字符串(用于通知和错误信息等) - 2

    大约一年前,我决定确保每个包含非唯一文本的Flash通知都将从模块中的方法中获取文本。我这样做的最初原因是为了避免一遍又一遍地输入相同的字符串。如果我想更改措辞,我可以在一个地方轻松完成,而且一遍又一遍地重复同一件事而出现拼写错误的可能性也会降低。我最终得到的是这样的:moduleMessagesdefformat_error_messages(errors)errors.map{|attribute,message|"Error:#{attribute.to_s.titleize}#{message}."}enddeferror_message_could_not_find(obje

  2. ruby-on-rails - 如何从 format.xml 中删除 <hash></hash> - 2

    我有一个对象has_many应呈现为xml的子对象。这不是问题。我的问题是我创建了一个Hash包含此数据,就像解析器需要它一样。但是rails自动将整个文件包含在.........我需要摆脱type="array"和我该如何处理?我没有在文档中找到任何内容。 最佳答案 我遇到了同样的问题;这是我的XML:我在用这个:entries.to_xml将散列数据转换为XML,但这会将条目的数据包装到中所以我修改了:entries.to_xml(root:"Contacts")但这仍然将转换后的XML包装在“联系人”中,将我的XML代码修改为

  3. ruby-on-rails - rspec should have_select ('cars' , :options => ['volvo' , 'saab' ] 不工作 - 2

    关闭。这个问题需要detailsorclarity.它目前不接受答案。想改进这个问题吗?通过editingthispost添加细节并澄清问题.关闭8年前。Improvethisquestion在首页我有:汽车:VolvoSaabMercedesAudistatic_pages_spec.rb中的测试代码:it"shouldhavetherightselect"dovisithome_pathit{shouldhave_select('cars',:options=>['volvo','saab','mercedes','audi'])}end响应是rspec./spec/request

  4. ruby-on-rails - 迷你测试错误 : "NameError: uninitialized constant" - 2

    我遵循MichaelHartl的“RubyonRails教程:学习Web开发”,并创建了检查用户名和电子邮件长度有效性的测试(名称最多50个字符,电子邮件最多255个字符)。test/helpers/application_helper_test.rb的内容是:require'test_helper'classApplicationHelperTest在运行bundleexecraketest时,所有测试都通过了,但我看到以下消息在最后被标记为错误:ERROR["test_full_title_helper",ApplicationHelperTest,1.820016791]test

  5. ruby-on-rails - 如何在 Rails View 上显示错误消息? - 2

    我是rails的新手,想在form字段上应用验证。myviewsnew.html.erb.....模拟.rbclassSimulation{:in=>1..25,:message=>'Therowmustbebetween1and25'}end模拟Controller.rbclassSimulationsController我想检查模型类中row字段的整数范围,如果不在范围内则返回错误信息。我可以检查上面代码的范围,但无法返回错误消息提前致谢 最佳答案 关键是您使用的是模型表单,一种显示ActiveRecord模型实例属性的表单。c

  6. 使用 ACL 调用 upload_file 时出现 Ruby S3 "Access Denied"错误 - 2

    我正在尝试编写一个将文件上传到AWS并公开该文件的Ruby脚本。我做了以下事情:s3=Aws::S3::Resource.new(credentials:Aws::Credentials.new(KEY,SECRET),region:'us-west-2')obj=s3.bucket('stg-db').object('key')obj.upload_file(filename)这似乎工作正常,除了该文件不是公开可用的,而且我无法获得它的公共(public)URL。但是当我登录到S3时,我可以正常查看我的文件。为了使其公开可用,我将最后一行更改为obj.upload_file(file

  7. ruby-on-rails - 错误 : Error installing pg: ERROR: Failed to build gem native extension - 2

    我克隆了一个rails仓库,我现在正尝试捆绑安装背景:OSXElCapitanruby2.2.3p173(2015-08-18修订版51636)[x86_64-darwin15]rails-v在您的Gemfile中列出的或native可用的任何gem源中找不到gem'pg(>=0)ruby​​'。运行bundleinstall以安装缺少的gem。bundleinstallFetchinggemmetadatafromhttps://rubygems.org/............Fetchingversionmetadatafromhttps://rubygems.org/...Fe

  8. ruby - #之间? Cooper 的 *Beginning Ruby* 中的错误或异常 - 2

    在Cooper的书BeginningRuby中,第166页有一个我无法重现的示例。classSongincludeComparableattr_accessor:lengthdef(other)@lengthother.lengthenddefinitialize(song_name,length)@song_name=song_name@length=lengthendenda=Song.new('Rockaroundtheclock',143)b=Song.new('BohemianRhapsody',544)c=Song.new('MinuteWaltz',60)a.betwee

  9. ruby-on-rails - 每次我尝试部署时,我都会得到 - (gcloud.preview.app.deploy) 错误响应 : [4] DEADLINE_EXCEEDED - 2

    我是Google云的新手,我正在尝试对其进行首次部署。我的第一个部署是RubyonRails项目。我基本上是在关注thisguideinthegoogleclouddocumentation.唯一的区别是我使用的是我自己的项目,而不是他们提供的“helloworld”项目。这是我的app.yaml文件runtime:customvm:trueentrypoint:bundleexecrackup-p8080-Eproductionconfig.ruresources:cpu:0.5memory_gb:1.3disk_size_gb:10当我转到我的项目目录并运行gcloudprevie

  10. ruby-on-rails - Rails 5 Active Record 记录无效错误 - 2

    我有两个Rails模型,即Invoice和Invoice_details。一个Invoice_details属于Invoice,一个Invoice有多个Invoice_details。我无法使用accepts_nested_attributes_forinInvoice通过Invoice模型保存Invoice_details。我收到以下错误:(0.2ms)BEGIN(0.2ms)ROLLBACKCompleted422UnprocessableEntityin25ms(ActiveRecord:4.0ms)ActiveRecord::RecordInvalid(Validationfa

随机推荐