本文章出自:
https://juejin.im/post/59df8033518825693d7b4538
由于刚刚入门android开发,想学习一下APP后端开发,故在网上找了一个demo,调试一下跑通了,本文章主要记录,github上down下来的代码怎么调通。
app后台代码:https://github.com/luqinmao/HomeServer
(1)先运行自带的home.sql文件,生成对应的数据库。
(2)修改db.properties文件,密码修改成自己的mysql密码。
(3)修改Tomcat版本,修改java版本。
android代码:https://github.com/luqinmao/Home
(1)修改 AppConst.java文件,将ip地址改成自己的。
(2)将gradle-wrapper.properties文件改成4.4-all。
(3)将Home目录下的build.gradle文件改成3.1.2。
(4)主要修改app目录下的build.gradle文件,修改结果如下:
apply plugin: 'com.android.application'
android {
signingConfigs {
config {
}
config1 {
keyAlias 'home'
keyPassword '123456'
storeFile file('/home/gs/01_android/signed/home.jks')
storePassword '123456'
}
}
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.lqm.home"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
ndk {
//设置支持的SO库架构
abiFilters "armeabi-v7a", "x86", "arm64-v8a", "x86_64","armeabi"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config1
}
debug {
signingConfig signingConfigs.config1
}
}
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
/*暂时解决打包时fragment重载构造方法问题*/
lintOptions {
checkReleaseBuilds false
abortOnError false
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
}
repositories{
flatDir{
dirs 'libs' //放arr的目录地址
}
}
dependencies {
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support:cardview-v7:27.1.1'
compileOnly 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'de.hdodenhof:circleimageview:2.0.0'
implementation 'me.drakeet.materialdialog:library:1.2.2'
//okgo
implementation 'com.lzy.net:okgo:2.1.4'
//3.0版本为不兼容升级
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:v2.0.7'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.jakewharton:butterknife:7.0.1'
implementation 'com.lzy.widget:ninegridview:0.2.1'
implementation 'com.lzy.widget:imagepicker:0.5.5'
implementation files('libs/pinyin4j-2.5.0.jar')
annotationProcessor 'com.jakewharton:butterknife:7.0.1'
//数据库
implementation 'org.litepal.android:core:1.4.1'
/*==========加入SCDN_LQR云信模块后添加的引用 ==========*/
// 网易云信添加依赖。注意,版本号必须一致。
// 基础功能 (必需)
implementation 'com.netease.nimlib:basesdk:3.2.0'
// 音视频需要
implementation 'com.netease.nimlib:avchat:3.2.0'
// 聊天室需要
implementation 'com.netease.nimlib:chatroom:3.2.0'
//PhotoView 图片浏览缩放控件
implementation 'com.bm.photoview:library:1.4.1'
//表情库
implementation 'com.lqr.emoji:library:1.0.2'
//下拉刷新上拉加载更多控件
implementation 'cn.bingoogolapple:bga-refreshlayout:1.1.7@aar'
// http请求/json解析
implementation 'com.google.code.gson:gson:2.8.0'
implementation 'com.alibaba:fastjson:1.2.23'
//万能适配器
implementation 'com.lqr.adapter:library:1.0.1'
//简单的RecyclerView
implementation 'com.lqr.recyclerview:library:1.0.2'
//安卓视频录制控件,可以用来仿微信小视频
implementation 'com.lqr.videorecordview:library:1.0.0'
//获取权限
implementation 'com.lovedise:permissiongen:0.0.6'
//仿微信群头像九宫格控件
implementation 'com.lqr.ninegridimageview:library:1.0.0'
// 开关控件
implementation 'com.kyleduo.switchbutton:library:1.4.4'
implementation 'de.greenrobot:eventbus:3.0.0-beta1'
//条形码二维码生成扫描
implementation 'com.google.zxing:core:3.2.1'
implementation 'cn.bingoogolapple:bga-qrcodecore:1.1.7@aar'
implementation 'cn.bingoogolapple:bga-zxing:1.1.7@aar'
/*=================== end ============================*/
//地区选择
implementation 'liji.library.dev:citypickerview:1.0.0'
//时间格式
implementation files('libs/joda-time-2.5.jar')
implementation files('libs/joda-time-2.5-sources.jar')
//mob短信验证码
implementation name: 'SMSSDK-2.1.3', ext: 'aar'
implementation files('libs/MobCommons-2016.1201.1839.jar')
implementation files('libs/MobTools-2016.1201.1839.jar')
//信鸽推送
implementation files('libs/jg_filter_sdk_1.1.jar')
implementation files('libs/wup-1.0.0.E-SNAPSHOT.jar')
implementation files('libs/Xg_sdk_v3.1_20170417_0946.jar')
implementation files('libs/mid-core-sdk-3.7.2.jar')
//ViewPager
implementation 'cn.bingoogolapple:bga-banner:2.1.7@aar'
//图片压缩
implementation 'com.github.nanchen2251:CompressHelper:1.0.5'
//百度地图
implementation files('libs/baidumapapi_base_v4_3_1.jar')
implementation files('libs/baidumapapi_map_v4_3_1.jar')
implementation files('libs/baidumapapi_util_v4_3_1.jar')
implementation files('libs/locSDK_6.13.jar')
}