Skip to content

Failed to apply plugin [id 'replugin-plugin-gradle'] #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ikakaxi opened this issue Jul 2, 2017 · 12 comments
Closed

Failed to apply plugin [id 'replugin-plugin-gradle'] #53

ikakaxi opened this issue Jul 2, 2017 · 12 comments

Comments

@ikakaxi
Copy link

ikakaxi commented Jul 2, 2017

#43 这个问题里,我开始也是这么做的,我看作者说不建议这么做,我就单独建了一个工程,然而还是这种错误
代码我提交到了https://github.com/ikakaxi/TestRePlugin_plugin ,请作者帮忙看一下哪里的问题,我是按照https://github.com/Qihoo360/RePlugin/wiki/插件接入指南 这里的文档做的

@wangyupeng1-iri
Copy link
Contributor

wangyupeng1-iri commented Jul 2, 2017

我fork了下你仓库修改了下配置,可以正常运行了。我已经将自己修改提交PR给你,你merge下就应该可以了。主要问题是gradle的版本问题和apply plugin: 'replugin-plugin-gradle'这个引用位置,这个位置要放在build.gradle文件的末尾处。谢谢的你的issue。

@whosmyqueen
Copy link

@wangyupeng1-iri host里面apply plugin: 'replugin-host-gradle'这个就不用放到文件末尾-,-,奇怪了

@wangyupeng1-iri
Copy link
Contributor

wangyupeng1-iri commented Jul 2, 2017

@whosmyqueen 不一样,这个要自动读取前面build.gradle的配置内容,如果放在前面,会读为空。我们内部讨论过这个问题,如果要想自由放置就得传参配置。当时考虑到尽量减少传参配置就约定俗成让放在文件末尾。你可以看demo1

@ikakaxi
Copy link
Author

ikakaxi commented Jul 2, 2017

@wangyupeng1-iri 解决了,谢谢,你们不忙的时候把文档更新也尽量保持同步吧,如果第一次建项目按照文档成功不了的,比如https://github.com/Qihoo360/RePlugin/wiki/主程序接入指南 这里没有写需要在项目根节点的build.gradle配置maven { url "https://dl.bintray.com/qihoo360/replugin" }
,也没有写必须在宿主Module的assets下面增加plugins文件夹,即使里面没有插件文件,否则会报Error:Execution failed for task ':app:processDebugResources'.>/Users/xxx/Documents/WorkSpace/WorkSpaceAndroid/TestRePlugin/app/src/main/assets/plugins错误,现在都是看文档加看demo,还要和demo对比代码差异,不然总出错,光看文档不行,文档不全

@ikakaxi
Copy link
Author

ikakaxi commented Jul 2, 2017

@wangyupeng1-iri
repluginPluginConfig { includedInjectors = ['LoaderActivityInjector', 'ProviderInjector'] }这段话去掉也能编译通过,这句话是做什么的?我看文档里并没有说要写这个

@jiongxuan
Copy link
Contributor

jiongxuan commented Jul 2, 2017

@ikakaxi 这个问题问的好。

针对第一个问题,我们会尽快更新文档,不让后面的同学费解。但到下一版(2.1.1)时,确实就不会再有您提到的这些困惑了。换言之,再过两天,用现在的接入文档,就可以毫无费解的使用RePlugin了。

而第二个问题。其实我们当初加上这句话,主要是想让大家能“自由控制”其“动态编译方案”的“修改点”。例如,有的插件觉得自己替换Activity基类会更好,所以可以不需要写LoaderActivityInjector,这样可节省一定的编译时间。

我们在下一版(2.1.1)将不再需要编写includedInjectors,而是默认全部Inject,除非开发者刻意选择用 ignoreInjectors来忽略。此改动已由我们的 @erhu 兄提了PR并合入Master。

我们近期会逐步完善文档。敬请期待。

@ikakaxi
Copy link
Author

ikakaxi commented Jul 3, 2017

@jiongxuan 谢谢解答,我还有个问题,工程中的gradle->warpper->gradle-wrapper.properties文件的distributionUrl必须为https://services.gradle.org/distributions/gradle-2.14.1-all.zip吗?我试了@wangyupeng1-iri 帮我解决的方法,我那个问题确实有gradle版本的原因,gradle版本换成2.14.1并且把apply plugin: 'replugin-plugin-gradle'放到文件末尾就解决了,gradle-wrapper.properties文件中的gradle版本是不是必须是2.14.1?

@aBenVip
Copy link

aBenVip commented Jul 3, 2017

@jiongxuan 你好,host官方Sample可以正常运行,插件Simple程序运行后就报错apply plugin: 'replugin-host-gradle',这个需要怎么解决呢?Demo1可以编译,Demo2编译报错,我自己新建的插件配置也报错,已参照前面的解答

已解决

@jiongxuan
Copy link
Contributor

谢谢。请期待我们下一版2.1.1,这些大多都不是事儿了。尤其是在JCenter审核通过以后。

@chenchengyin
Copy link

我的版本是2.3.3。
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 29
buildToolsVersion "29.0.2"

defaultConfig {
    applicationId "com.sds.docsplugin"
    minSdkVersion 21
    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'
    }
}

lintOptions {
    abortOnError false
}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
}

}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

//replugin
implementation 'com.qihoo360.replugin:replugin-plugin-lib:2.3.3'

// implementation "com.qihoo360.replugin:replugin-plugin-lib:${RP_VERSION}"
}
// 这个plugin需要放在android配置之后,因为需要读取android中的配置项

apply plugin: 'replugin-plugin-gradle'
repluginPluginConfig {
//插件名
pluginName = "docs"
//宿主app的包名
hostApplicationId = "com.qihoo360.replugin.sample.host"
//宿主app的启动activity
hostAppLauncherActivity = "com.qihoo360.replugin.sample.host.MainActivity"
}

还是会报错:
Build file '/app/build.gradle' line: 62
A problem occurred evaluating project ':app'.

Plugin with id 'replugin-plugin-gradle' not found.

@liuqingdada
Copy link

liuqingdada commented May 29, 2020

@chenchengyin 我也一样报错,和你的配置一样

@AAChartModel
Copy link

我也一样,问题并没有完全解决啊.

我的版本是2.3.3。
还是会遇到上述问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants