我無法編譯我的 Android Kotlin 項目,因為在 gradle 編譯時出現以下“Kotlin 編譯器”錯誤:Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath: class sensor_msgs.CompressedImage, unresolved supertypes: org.ros.internal.message.Message> Task:app:buildInfoGeneratorDebug這是一個簡單的測試項目,只有最少的代碼。常規 android 應用程序之間的主要區別。這是我的 MainActivity 使用類 RosActivity 而不是 AppCompatActivity。我已經更改了'ext.kotlin_version'(無法解析以下類的超類型。請確保您在類路徑中具有所需的依賴項:)我嘗試更改依賴項的順序(錯誤:無法解析以下類的超類型。請確保您在類路徑中具有所需的依賴項)我試過'resolutionStrategy.force'(錯誤:無法解析以下類的超類型。請確保您在類路徑中具有所需的依賴項)我試過“無效緩存/重新啟動”(錯誤:無法解析以下類的超類型。請確保您在類路徑中具有所需的依賴項)我更改了 'org.jetbrains.kotlin:kotlin' 但這沒有用(無法解析以下類的超類型)清單.xml:<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.company.roscameratest"> <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" tools:replace="android:icon"> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:name="org.ros.android.MasterChooser" /> <service android:name="org.ros.android.NodeMainExecutorService" > <intent-filter> <action android:name="org.ros.android.NodeMainExecutorService" /> </intent-filter> </service> </application></manifest>
1 回答

慕碼人8056858
TA貢獻1803條經驗 獲得超6個贊
在gradle中,如果你的項目實現了A,但是A也實現了B。如果你的項目使用了A中的某個類,擴展了B中的類,你可以只調用構造方法,不能調用B中調用superClass的方法,或者使用它方法參數。
只是嘗試實現api。
api 'org.ros.android_core:android_15:0.3.3'
添加回答
舉報
0/150
提交
取消