android - 尝试使用 mainClassName 时出错
问题描述
我正在尝试使用此SMS 服务,但是在设置 SMSBackend 类时,我无法设置 mainClassName,因此我无法在最后几个小时内获得博客中给出的链接我被困在这个我试过了jar方法,只有类名,这里的全类名是我的gradle文件
buildscript {
repositories { jcenter() }
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3'
}
}
apply plugin: 'com.android.application'
apply plugin: 'com.github.johnrengelman.shadow'
android {
compileSdkVersion 28
defaultConfig {
applicationId "net.iquesoft.smsapp"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
mainClassName = 'net.iquesoft.smsapp.SMSBackend'
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
testImplementation 'junit:junit:4.12'
implementation 'com.sparkjava:spark-core:2.6.0'
implementation group: 'com.twilio.sdk', name: 'twilio', version: '7.9.0'
implementation 'org.slf4j:slf4j-simple:1.6.1'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
我收到这样的错误
Could not set unknown property 'mainClassName' for object of type com.android.build.gradle.internal.dsl.BaseAppModuleExtension.
解决方案
您正在创建一个 Android 项目来生成后端。
正如他在此处所说,您必须使用 Spark 框架创建一个 Java 项目,并且当您运行后端时,您可以创建您的 Android 项目。
推荐阅读
- django-models - 如何在(递归关系)中设置动态关系
- r - 这种网络交互数据结构如何用于 ggraph 中的网络可视化?
- sql-server - 想要使用 sql server 显示 SKU 组中每个父贸易号的子贸易号
- javascript - 如何通过python中的数据回调提交/发布javascript函数?
- c - 函数“pthread_create”的参数太多
- ios - 遍历 JSON 数组并将坐标添加到地图
- wso2 - WSO2 身份服务器用户会话破坏端点
- html - 将图像移到另一个标签上方
- ruby-on-rails-5 - 从 Rails 5.1.4 升级到 Rails 6 时出现问题
- xml - XSD / XML 引用转义