我要用到的是tensorflow-lite,但是编译器找不到。
-
解决方法1:
打开File->Project Structure->app->Dependencies,点击右上角加号,如图:
点击第一个,得到如下图所示。在这里检索tensorflow的库。我们这里要添加的是“org.tensorflow:tensorflow-lite:+”,有可能在这里检索不到。如果检索不到,就参考解决方法2。
-
解决方法2
直接到工程的build.gradle中,在
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
添加
implementation 'org.tensorflow:tensorflow-lite:+'
其实解决方法2中的文件与解决方法1中的设置是同步的,但是可能存在一些bug,导致有些库只能通过方法2添加。