道1993 2025-02-11 16:04 采纳率: 57.1%
浏览 29
已结题

tower地面站出现Execution failed for task ':ClientLib:compileDebugAidl'.

```xml

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':ClientLib:compileDebugAidl'.

    A failure occurred while executing com.android.build.gradle.tasks.AidlCompile$AidlCompileRunnable
    com.android.ide.common.process.ProcessException: Error while executing process D:\AndroidStudio\SDK\build-tools\33.0.0\aidl.exe with arguments {-pD:\AndroidStudio\SDK\platforms\android-33\framework.aidl -oE:\yunzhuoproject\OpenTower-skydroid\ClientLib\build\generated\aidl_source_output_dir\debug\out -IE:\yunzhuoproject\OpenTower-skydroid\ClientLib\src\main\java -IE:\yunzhuoproject\OpenTower-skydroid\ClientLib\src\main\aidl -IE:\yunzhuoproject\OpenTower-skydroid\ClientLib\src\debug\aidl -ID:\gradle\gradle-7.0.2\caches\transforms-3\7e3020c2945e349a6ba960c7bf3855aa\transformed\media-1.0.0\aidl -ID:\gradle\gradle-7.0.2\caches\transforms-3\b47cc11234454b3bab1070d3853c507a\transformed\core-1.0.0\aidl -ID:\gradle\gradle-7.0.2\caches\transforms-3\769950198ea9fb1358d5fd8ab6230fc4\transformed\versionedparcelable-1.0.0\aidl -dC:\Users\Administrator\AppData\Local\Temp\aidl3207980883822576065.d E:\yunzhuoproject\OpenTower-skydroid\ClientLib\src\main\java\com\o3dr\services\android\lib\drone\calibration\magnetometer\MagnetometerCalibrationProgress.aidl}

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org/

BUILD FAILED in 20s

```主要是这个问题是什么原因造成的

  • 写回答

5条回答 默认 最新

  • 檀越@新空间 2025-02-11 16:05
    关注

    下午好🌅🌅🌅
    本答案参考通义千问

    你遇到的问题是因为从 Android 12 开始,如果你的应用目标 SDK 版本是 Android 12 或更高版本,并且你的 <activity> 元素中定义了 <intent-filter>,那么你必须显式地设置 android:exported 属性。

    根据你的描述,你已经为 <activity> 设置了 android:exported="true",但仍然出现了错误。这可能是因为某些地方没有正确设置或者有其他未被注意到的 <activity> 元素。

    以下是详细的解决方案:

    1. 检查所有 <activity> 元素:确保每个带有 <intent-filter><activity> 都明确设置了 android:exported 属性。

    2. 添加或更新 android:exported 属性:确保所有 <activity> 元素都包含 android:exported 属性。

    下面是修改后的 AndroidManifest.xml 示例:

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
              package="com.o3dr.android.client">
    
        <uses-permission android:name="android.permission.INTERNET"/>
    
        <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
        <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
        <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
        <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
        <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
        <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
        <uses-permission android:name="android.permission.BLUETOOTH"/>
        <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
    
        <!-- Support devices without Bluetooth since there are other connection types -->
        <uses-feature
            android:name="android.hardware.bluetooth"
            android:required="false"/>
    
        <!-- Support devices without USB host mode since there are other connection types -->
        <uses-feature
            android:name="android.hardware.usb.host"
            android:required="false"/>
    
        <!-- Support devices that don't have location services -->
        <uses-feature
            android:name="android.hardware.location.gps"
            android:required="false"/>
        <uses-feature
            android:name="android.hardware.location.network"
            android:required="false"/>
        <uses-feature
            android:name="android.hardware.location"
            android:required="false"/>
    
        <application>
    
            <activity
                android:name="org.droidplanner.services.android.impl.ui.activity.UsbIntentReceiver"
                android:launchMode="singleInstance"
                android:noHistory="true"
                android:exported="true"
                android:excludeFromRecents="true">
                <!-- USB connection intent -->
                <intent-filter>
                    <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"/>
                </intent-filter>
    
                <meta-data
                    android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
                    android:resource="@xml/device_filter"/>
            </activity>
    
            <service
                android:name="org.droidplanner.services.android.impl.api.DroidPlannerService"
                android:exported="true"
                android:enabled="false">
    
                <!-- Filter and meta data for the Tower lib runtime -->
                <intent-filter>
                    <action android:name="com.o3dr.services.android.lib.model.IDroidPlannerServices" />
                </intent-filter>
    
                <meta-data
                    android:name="com.o3dr.dronekit.android.core.version"
                    android:value="@integer/core_lib_version" />
            </service>
    
        </application>
    
    </manifest>
    

    关键点:

    • 确保所有带有 <intent-filter><activity> 元素都有 android:exported 属性。
    • 在示例中,android:exported="true" 已经被设置在 <activity> 元素中。

    通过以上步骤,你应该能够解决 android:exported 需要显式指定的问题。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

问题事件

  • 系统已结题 2月26日
  • 已采纳回答 2月18日
  • 修改了问题 2月11日
  • 创建了问题 2月11日