3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

AndroidStudioでAPKファイルを作るとき、DebugはできるがReleaseでエラーになる場合の対処方法

Last updated at Posted at 2016-01-03

AndroidStudioでAPKファイルを作るとき、DebugはできるがReleaseで以下のエラーが出力されビルドできず、嵌ってしまったので対処方法を書いておく。
Error:(13) Error: This class should provide a default constructor (a public constructor with no arguments)

上記エラーメッセージによると対象のクラスにデフォルトコンストラクターを書けといっているようだが、対象のクラスはSQLiteOpenHelperを継承しており、デフォルトコンストラクターは作成できない。全く意味がわからず時間を空費してしまったが以下の方法で対処できた。

参考にしたサイト。
http://stackoverflow.com/questions/29046829/error-building-signed-apk-in-android-studio-this-class-should-provide-default-c

appの配下にあるbuild.gradle内に

 lintOptions {
    abortOnError false
 }

releaseではエラーがあるとビルドを途中でやめてしまうらしいので、上記のオプションでそれを防ぐとのこと。

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?