繼上github page教程我有:DeepLinkDispatch - 不兼容的類型:列表<Object>不能轉換爲List <DeepLinkEntry>
添加到我的項目的父build.gradle
:
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' <---
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
添加到我的應用程序的build.gradle
:
apply plugin: 'com.neenbedankt.android-apt'
...
compile 'com.airbnb:deeplinkdispatch:3.0.0'
apt 'com.airbnb:deeplinkdispatch-processor:3.0.0'
創建了一個模塊類並對其進行了註釋:
@DeepLinkModule
public class AppDeepLinkModule
{
}
現在,當我嘗試建立,它顯示上面的錯誤消息:
Error:(12, 82) error: incompatible types: List<Object> cannot be converted to List<DeepLinkEntry>
然後,它指出了我對這一類,這是自動生成的:
public final class AppDeepLinkModuleLoader implements Parser {
public static final List<DeepLinkEntry> REGISTRY = Collections.unmodifiableList(Arrays.asList(
)); <-- this line here
@Override
public DeepLinkEntry parseUri(String uri) {
for (DeepLinkEntry entry : REGISTRY) {
if (entry.matches(uri)) {
return entry;
}
}
return null;
}
}
我已經提到他們的示例應用程序和我的似乎完全相同Here is a link到他們的班級做同樣的事情。
我完成了進一步的步驟,直到我需要使用autogenerated類,以防萬一這是問題,但這並沒有解決問題。 AndroidManifest.xml
:
<activity
android:name=".deeplink.DeepLinkActivity"
android:theme="@android:style/Theme.NoDisplay">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data
android:host="slackwebsocket"
android:scheme="http"/>
</intent-filter>
</activity>
DeepLinkActivity
:
@DeepLinkHandler({AppDeepLinkModule.class})
public class DeepLinkActivity extends AppCompatActivity
{
@Override
protected void onCreate(@Nullable Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
}
}
我該如何解決這個問題?
我得到這個錯誤:'插件ID爲「com.neenbedankt.android-容易」不found.'項目'build.gradle'您需要添加行 – nandsito
@nandsito: '類路徑「融爲一體。 neenbedankt.gradle.plugins:android-apt:1.8'' in buildscript {dependencies {'。 我將編輯問題 –
我看到你在github上打開了一個問題。如果問題實際上就是我在答案中提到的問題,我認爲他們應該確實解決它 – nandsito