我正在做一个android项目,当我运行这个项目时,它立即崩溃,我试着调试,我发现问题在于我从android库中使用的方法,如图中所示(https://i.stack.imgur.com/a6bKI.png)。
我更新了android,修复了IDE,在build.gradle文件中添加了所需的依赖项,但是问题没有解决。
贝娄是build.gradle
<code class="language-javascript">plugins <span class="token punctuation">{</span> id <span class="token string">'com.android.application'</span> <span class="token punctuation">}</span> android <span class="token punctuation">{</span> namespace <span class="token string">'com.example.readerapp'</span> compileSdk <span class="token number">33</span> defaultConfig <span class="token punctuation">{</span> applicationId <span class="token string">"com.example.readerapp"</span> minSdk <span class="token number">21</span> targetSdk <span class="token number">33</span> versionCode <span class="token number">1</span> versionName <span class="token string">"1.0"</span> testInstrumentationRunner <span class="token string">"androidx.test.runner.AndroidJUnitRunner"</span> <span class="token punctuation">}</span> buildTypes <span class="token punctuation">{</span> release <span class="token punctuation">{</span> minifyEnabled <span class="token boolean">false</span> proguardFiles <span class="token function">getDefaultProguardFile</span><span class="token punctuation">(</span><span class="token string">'proguard-android-optimize.txt'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token string">'proguard-rules.pro'</span> <span class="token punctuation">}</span> <span class="token punctuation">}</span> compileOptions <span class="token punctuation">{</span> sourceCompatibility JavaVersion<span class="token punctuation">.</span><span class="token constant">VERSION_1_8</span> targetCompatibility JavaVersion<span class="token punctuation">.</span><span class="token constant">VERSION_1_8</span> <span class="token punctuation">}</span> <span class="token punctuation">}</span> dependencies <span class="token punctuation">{</span> implementation <span class="token string">'androidx.appcompat:appcompat:1.5.1'</span> implementation <span class="token string">"androidx.annotation:annotation:1.5.0"</span> implementation <span class="token string">"androidx.constraintlayout:constraintlayout:2.1.4"</span> implementation <span class="token string">"androidx.constraintlayout:constraintlayout-compose:1.0.1"</span> implementation <span class="token string">'com.google.android.material:material:1.5.0'</span> implementation <span class="token function">files</span><span class="token punctuation">(</span><span class="token string">'libs\\uhfcom13_eu_v15.jar'</span><span class="token punctuation">)</span> implementation <span class="token function">files</span><span class="token punctuation">(</span><span class="token string">'libs\\SerialPort.jar'</span><span class="token punctuation">)</span> <span class="token punctuation">}</span></code>
admin 已回答的问题 11 9 月, 2023
Stack Overflow用户
发布于 2022-11-26 05:32:13
<code class="language-javascript">implementation <span class="token function">files</span><span class="token punctuation">(</span><span class="token string">'libs\\uhfcom13_eu_v15.jar'</span><span class="token punctuation">)</span> implementation <span class="token function">files</span><span class="token punctuation">(</span><span class="token string">'libs\\SerialPort.jar'</span><span class="token punctuation">)</span></code>
复制
代之以:
<code class="language-javascript">implementation <span class="token function">files</span><span class="token punctuation">(</span><span class="token string">'libs\uhfcom13_eu_v15.jar'</span><span class="token punctuation">)</span> implementation <span class="token function">files</span><span class="token punctuation">(</span><span class="token string">'libs\SerialPort.jar'</span><span class="token punctuation">)</span></code>
admin 已回答的问题 11 9 月, 2023
阅读全文