毕设day31
今天把项目导入进来,看结合注册登录能不能运行起来,还有学会bmob的增删改查和mysql的区别
bug1:
Duplicate class android.support.v4.app.INotificationSideChannel found in modules classes.........
as版本问题,需要在gradle.properties中添加下面两行代码
这是因为混合支持库。通过添加这些行选择androidX作为您的支持库
android.useAndroidX=true
android.enableJetifier=true

解决问题
bug2:
����: �����android.support.design.widget������
import android.support.design.widget.FloatingActionButton;

看报错建议我们选择Androidx的依赖,
所以解决办法是:
①修改依赖:
build.gradle里面,把原来的design那句删除,然后导入依赖
// FloatingActionButton在androidx报错的修改依赖
implementation 'com.google.android.material:material:1.2.1'
②修改布局
在布局中的 android.support.design.widget.FloatingActionButton;改成:
com.google.android.material.floatingactionbutton.FloatingActionButton
③java文件里也要改哦,导包:
import android.support.design.widget.FloatingActionButton;
改成:
import com.google.android.material.floatingactionbutton.FloatingActionButton;
具体参考网址:https://blog.csdn.net/qq_16388171/article/details/110384679
啊,又解决了一个bug,我真是个小机灵鬼!
下午继续(现在11:27)
bug3:
import android.support.annotation.Nullable;和import android.support.v7.app.AppCompatActivity;报错
别人的代码复制黏贴过来发现没法用,版本不一致,因为Google的升级,从v4到v7到Androidx,所以
应该将:
import android.support.annotation.Nullable;改为:import androidx.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;改为:import androidx.appcompat.app.AppCompatActivity;
还有:
import android.support.v7.app.AlertDialog;换成:androidx.appcompat.app.AlertDialog
import android.support.design.widget.NavigationView;换成 import com.google.android.material.navigation.NavigationView;
好像都是导包的问题哈,果然复制别人的代码都是要付出代价的
找到个规律:
design包的就是com.google.app.****
v4,v7就是androidx.appcompat.****
总之,就是把这些Androidx不支持的包都替换掉就好了
贴上androidx和android.support的对照表,可能有重复,ctrl+f查询就完事了
还有其他的如Android.support.v7*
https://blog.csdn.net/qulonglong110/article/details/106333440/,
v4.*
ctrl+f查询就完事了
| android.support | AndroidX |
|---|---|
| android.arch.core:common | androidx.arch.core:core-common:2.0.0-rc01 |
| android.arch.core:core | androidx.arch.core:core:2.0.0-rc01 |
| android.arch.core:core-testing | androidx.arch.core:core-testing:2.0.0-rc01 |
| android.arch.core:runtime | androidx.arch.core:core-runtime:2.0.0-rc01 |
| android.arch.lifecycle:common | androidx.lifecycle:lifecycle-common:2.0.0-rc01 |
| android.arch.lifecycle:common-java8 | androidx.lifecycle:lifecycle-common-java8:2.0.0-rc01 |
| android.arch.lifecycle:compiler | androidx.lifecycle:lifecycle-compiler:2.0.0-rc01 |
| android.arch.lifecycle:extensions | androidx.lifecycle:lifecycle-extensions:2.0.0-rc01 |
| android.arch.lifecycle:livedata | androidx.lifecycle:lifecycle-livedata:2.0.0-rc01 |
| android.arch.lifecycle:livedata-core | androidx.lifecycle:lifecycle-livedata-core:2.0.0-rc01 |
| android.arch.lifecycle:reactivestreams | androidx.lifecycle:lifecycle-reactivestreams:2.0.0-rc01 |
| android.arch.lifecycle:runtime | androidx.lifecycle:lifecycle-runtime:2.0.0-rc01 |
| android.arch.lifecycle:viewmodel | androidx.lifecycle:lifecycle-viewmodel:2.0.0-rc01 |
| android.arch.paging:common | androidx.paging:paging-common:2.0.0-rc01 |
| android.arch.paging:runtime | androidx.paging:paging-runtime:2.0.0-rc01 |
| android.arch.paging:rxjava2 | androidx.paging:paging-rxjava2:2.0.0-rc01 |
| android.arch.persistence.room:common | androidx.room:room-common:2.0.0-rc01 |
| android.arch.persistence.room:compiler | androidx.room:room-compiler:2.0.0-rc01 |
| android.arch.persistence.room:guava | androidx.room:room-guava:2.0.0-rc01 |
| android.arch.persistence.room:migration | androidx.room:room-migration:2.0.0-rc01 |
| android.arch.persistence.room:runtime | androidx.room:room-runtime:2.0.0-rc01 |
| android.arch.persistence.room:rxjava2 | androidx.room:room-rxjava2:2.0.0-rc01 |
| android.arch.persistence.room:testing | androidx.room:room-testing:2.0.0-rc01 |
| android.arch.persistence:db | androidx.sqlite:sqlite:2.0.0-rc01 |
| android.arch.persistence:db-framework | androidx.sqlite:sqlite-framework:2.0.0-rc01 |
| com.android.support.constraint:constraint-layout | androidx.constraintlayout:constraintlayout:1.1.2 |
| com.android.support.constraint:constraint-layout-solver | androidx.constraintlayout:constraintlayout-solver:1.1.2 |
| com.android.support.test.espresso.idling:idling-concurrent | androidx.test.espresso.idling:idling-concurrent:3.1.0 |
| com.android.support.test.espresso.idling:idling-net | androidx.test.espresso.idling:idling-net:3.1.0 |
| com.android.support.test.espresso:espresso-accessibility | androidx.test.espresso:espresso-accessibility:3.1.0 |
| com.android.support.test.espresso:espresso-contrib | androidx.test.espresso:espresso-contrib:3.1.0 |
| com.android.support.test.espresso:espresso-core | androidx.test.espresso:espresso-core:3.1.0 |
| com.android.support.test.espresso:espresso-idling-resource | androidx.test.espresso:espresso-idling-resource:3.1.0 |
| com.android.support.test.espresso:espresso-intents | androidx.test.espresso:espresso-intents:3.1.0 |
| com.android.support.test.espresso:espresso-remote | androidx.test.espresso:espresso-remote:3.1.0 |
| com.android.support.test.espresso:espresso-web | androidx.test.espresso:espresso-web:3.1.0 |
| com.android.support.test.janktesthelper:janktesthelper | androidx.test.jank:janktesthelper:1.0.1 |
| com.android.support.test.services:test-services | androidx.test:test-services:1.1.0 |
| com.android.support.test.uiautomator:uiautomator | androidx.test.uiautomator:uiautomator:2.2.0 |
| com.android.support.test:monitor | androidx.test:monitor:1.1.0 |
| com.android.support.test:orchestrator | androidx.test:orchestrator:1.1.0 |
| com.android.support.test:rules | androidx.test:rules:1.1.0 |
| com.android.support.test:runner | androidx.test?1.1.0 |
| com.android.support:animated-vector-drawable | androidx.vectordrawable:vectordrawable-animated:1.0.0 |
| com.android.support:appcompat-v7 | androidx.appcompat:appcompat:1.0.0 |
| com.android.support:asynclayoutinflater | androidx.asynclayoutinflater:asynclayoutinflater:1.0.0 |
| com.android.support:car | androidx.car?1.0.0-alpha5 |
| com.android.support:cardview-v7 | androidx.cardview:cardview:1.0.0 |
| com.android.support:collections | androidx.collection:collection:1.0.0 |
| com.android.support:coordinatorlayout | androidx.coordinatorlayout:coordinatorlayout:1.0.0 |
| com.android.support:cursoradapter | androidx.cursoradapter:cursoradapter:1.0.0 |
| com.android.support:customtabs | androidx.browser:browser:1.0.0 |
| com.android.support:customview | androidx.customview:customview:1.0.0 |
| com.android.support:design | com.google.android.material:material:1.0.0-rc01 |
| com.android.support:documentfile | androidx.documentfile:documentfile:1.0.0 |
| com.android.support:drawerlayout | androidx.drawerlayout:drawerlayout:1.0.0 |
| com.android.support:exifinterface | androidx.exifinterface:exifinterface:1.0.0 |
| com.android.support:gridlayout-v7 | androidx.gridlayout:gridlayout:1.0.0 |
| com.android.support:heifwriter | androidx.heifwriter:heifwriter:1.0.0 |
| com.android.support:interpolator | androidx.interpolator:interpolator:1.0.0 |
| com.android.support:leanback-v17 | androidx.leanback:leanback:1.0.0 |
| com.android.support:loader | androidx.loader:loader:1.0.0 |
| com.android.support:localbroadcastmanager | androidx.localbroadcastmanager:localbroadcastmanager:1.0.0 |
| com.android.support:media2 | androidx.media2:media2:1.0.0-alpha03 |
| com.android.support:media2-exoplayer | androidx.media2:media2-exoplayer:1.0.0-alpha01 |
| com.android.support:mediarouter-v7 | androidx.mediarouter:mediarouter:1.0.0 |
| com.android.support:multidex | androidx.multidex:multidex:2.0.0 |
| com.android.support:multidex-instrumentation | androidx.multidex:multidex-instrumentation:2.0.0 |
| com.android.support:palette-v7 | androidx.palette:palette:1.0.0 |
| com.android.support:percent | androidx.percentlayout:percentlayout:1.0.0 |
| com.android.support:preference-leanback-v17 | androidx.leanback:leanback-preference:1.0.0 |
| com.android.support:preference-v14 | androidx.legacy:legacy-preference-v14:1.0.0 |
| com.android.support:preference-v7 | androidx.preference:preference:1.0.0 |
| com.android.support:print | androidx.print:print:1.0.0 |
| com.android.support:recommendation | androidx.recommendation:recommendation:1.0.0 |
| com.android.support:recyclerview-selection | androidx.recyclerview:recyclerview-selection:1.0.0 |
| com.android.support:recyclerview-v7 | androidx.recyclerview:recyclerview:1.0.0 |
| com.android.support:slices-builders | androidx.slice:slice-builders:1.0.0 |
| com.android.support:slices-core | androidx.slice:slice-core:1.0.0 |
| com.android.support:slices-view | androidx.slice:slice-view:1.0.0 |
| com.android.support:slidingpanelayout | androidx.slidingpanelayout:slidingpanelayout:1.0.0 |
| com.android.support:support-annotations | androidx.annotation:annotation:1.0.0 |
| com.android.support:support-compat | androidx.core:core:1.0.0 |
| com.android.support:support-content | androidx.contentpager:contentpager:1.0.0 |
| com.android.support:support-core-ui | androidx.legacy:legacy-support-core-ui:1.0.0 |
| com.android.support:support-core-utils | androidx.legacy:legacy-support-core-utils:1.0.0 |
| com.android.support:support-dynamic-animation | androidx.dynamicanimation:dynamicanimation:1.0.0 |
| com.android.support:support-emoji | androidx.emoji:emoji:1.0.0 |
| com.android.support:support-emoji-appcompat | androidx.emoji:emoji-appcompat:1.0.0 |
| com.android.support:support-emoji-bundled | androidx.emoji:emoji-bundled:1.0.0 |
| com.android.support:support-fragment | androidx.fragment:fragment:1.0.0 |
| com.android.support:support-media-compat | androidx.media:media:1.0.0 |
| com.android.support:support-tv-provider | androidx.tvprovider:tvprovider:1.0.0 |
| com.android.support:support-v13 | androidx.legacy:legacy-support-v13:1.0.0 |
| com.android.support:support-v4 | androidx.legacy:legacy-support-v4:1.0.0 |
| com.android.support:support-vector-drawable | androidx.vectordrawable:vectordrawable:1.0.0 |
| com.android.support:swiperefreshlayout | androidx.swiperefreshlayout:swiperefreshlayout:1.0.0 |
| com.android.support:textclassifier | androidx.textclassifier:textclassifier:1.0.0 |
| com.android.support:transition | androidx.transition:transition:1.0.0 |
| com.android.support:versionedparcelable | androidx.versionedparcelable:versionedparcelable:1.0.0 |
| com.android.support:viewpager | androidx.viewpager:viewpager:1.0.0 |
| com.android.support:wear | androidx.wear:wear:1.0.0 |
| com.android.support:webkit | androidx.webkit:webkit:1.0.0 |
bug4:Override报错的问题:
解决:
按照提示在其他activity里添加接口
bug5:
java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead.
解决:
给你项目的res下的values-styles.xml添加如下代码:
<item name="windowActionBar">false</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<item name="windowNoTitle">true</item>
我的如下:

参考网站:https://blog.csdn.net/u014133119/article/details/81184499
bug6:
Could not initialize class com.android.sdklib.repository.AndroidSdkHandler
不能初始化的问题,我是通过jdk版本解决的,刚开始项目是jdk8,后面有一次改成as自带的11版本,所以有错,改回来就好了
file-project structure-sdk location-
如图:

经过这些bug,终于成功的把别人的项目导入到我的项目中并运行起来了,虽然好像啥也没干成,但真是成就感爆满呢,不接受反驳
后面的任务就是学会bmob的增删改查,代替mysql
把注册登录的数据融入到这个题库app中
开始着手吧,now(16:44)一天又过去了
论文还没整出来,要疯了!
----------------------------------------------------------------------------------------------------额是分界线-------------------------------------------------------------------------------------------------------------------------
bug7:
Attempt to invoke virtual method 'void android.view.View.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
这个问题一般是指activity里和layout 里的控件没有定义好,比如layout里写了个button,但是activity里面没有对他定义或者findviewbyid等。
在这里说明一下,怕以后又犯病忘了什么错了
到此为止完成了项目的融合,注册登录进去主页没有bug,算是比较顺利
现在到19:30做论文,
明天继续项目的改进
(18:23)
浙公网安备 33010602011771号