Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.24 KB | None | 0 0
  1. error: Entities and Pojos must have a usable public constructor. You can have an empty constructor or a constructor whose parameters match the fields (by name and type).
  2. Tried the following constructors but they failed to match:
  3. User(int,java.lang.String) : [arg0 : null, arg1 : null]
  4. User(java.lang.String) : [arg0 : null]
  5. error: Entities and Pojos must have a usable public constructor. You can have an empty constructor or a constructor whose parameters match the fields (by name and type).
  6. error: Entities and Pojos must have a usable public constructor. You can have an empty constructor or a constructor whose parameters match the fields (by name and type).
  7. error: Entities and Pojos must have a usable public constructor. You can have an empty constructor or a constructor whose parameters match the fields (by name and type).
  8. Tried the following constructors but they failed to match:
  9. Training(long,java.lang.String,java.util.List<com.caiquebrito.monteseutreino.data.model.TrainingJson>) : [arg0 : null, arg1 : null, arg2 : null]
  10. error: Entities and Pojos must have a usable public constructor. You can have an empty constructor or a constructor whose parameters match the fields (by name and type).
  11. error: Entities and Pojos must have a usable public constructor. You can have an empty constructor or a constructor whose parameters match the fields (by name and type).
  12. Tried the following constructors but they failed to match:
  13. User(int,java.lang.String) : [arg0 : null, arg1 : null]
  14. User(java.lang.String) : [arg0 : null]
  15. error: Entities and Pojos must have a usable public constructor. You can have an empty constructor or a constructor whose parameters match the fields (by name and type).
  16. error: Entities and Pojos must have a usable public constructor. You can have an empty constructor or a constructor whose parameters match the fields (by name and type).
  17. error: Entities and Pojos must have a usable public constructor. You can have an empty constructor or a constructor whose parameters match the fields (by name and type).
  18. Tried the following constructors but they failed to match:
  19. Training(long,java.lang.String,java.util.List<com.caiquebrito.monteseutreino.data.model.TrainingJson>) : [arg0 : null, arg1 : null, arg2 : null]
  20. error: Entities and Pojos must have a usable public constructor. You can have an empty constructor or a constructor whose parameters match the fields (by name and type).
  21. 10 errors
  22.  
  23. @Entity(tableName = "user")
  24. data class User(
  25. @PrimaryKey(autoGenerate = false)
  26. var uid: Int = 1,
  27. @ColumnInfo(name = "user_name")
  28. var name: String
  29. ) {
  30. constructor(name: String): this(1, name)
  31. }
  32.  
  33. @Entity(tableName = "training")
  34. data class Training(
  35. @PrimaryKey(autoGenerate = true)
  36. var uid: Long,
  37. var title: String,
  38. @Embedded
  39. var trainingsList: List<TrainingJson>
  40. )
  41.  
  42. @Entity(tableName = "trainingjson", foreignKeys = arrayOf(ForeignKey(entity = Training::class,
  43. parentColumns = arrayOf("uid"),
  44. childColumns = arrayOf("trainingId"),
  45. onDelete = ForeignKey.CASCADE)),
  46. indices = arrayOf(Index(value = "trainingId")))
  47. data class TrainingJson(
  48. @PrimaryKey(autoGenerate = true)
  49. var uid: Long,
  50. var trainingId: Long,
  51. var title: String,
  52. var value: String) : Parcelable {
  53.  
  54. constructor(): this(0, 0, "", "")
  55.  
  56. constructor(source: Parcel): this(source.readLong(), source.readLong(), source.readString(), source.readString())
  57.  
  58. override fun describeContents(): Int {
  59. return 0
  60. }
  61.  
  62. override fun writeToParcel(dest: Parcel, flags: Int) {
  63. dest.writeLong(this.uid)
  64. dest.writeLong(this.trainingId)
  65. dest.writeString(this.title)
  66. dest.writeString(this.value)
  67. }
  68.  
  69. companion object {
  70. @JvmField val CREATOR: Parcelable.Creator<TrainingJson> = object : Parcelable.Creator<TrainingJson> {
  71. override fun createFromParcel(source: Parcel): TrainingJson {
  72. return TrainingJson(source)
  73. }
  74.  
  75. override fun newArray(size: Int): Array<TrainingJson?> {
  76. return arrayOfNulls(size)
  77. }
  78. }
  79. }
  80. }
  81.  
  82. apply plugin: 'com.android.application'
  83. apply plugin: 'kotlin-android'
  84. apply plugin: 'kotlin-android-extensions'
  85.  
  86. android {
  87. compileSdkVersion 25
  88. buildToolsVersion '25.0.3'
  89. defaultConfig {
  90. applicationId "com.caiquebrito.monteseutreino"
  91. minSdkVersion 16
  92. targetSdkVersion 25
  93. versionCode 1
  94. versionName "1.0"
  95. testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
  96. }
  97. buildTypes {
  98. release {
  99. minifyEnabled false
  100. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  101. }
  102. }
  103. }
  104.  
  105. dependencies {
  106. compile fileTree(dir: 'libs', include: ['*.jar'])
  107. androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
  108. exclude group: 'com.android.support', module: 'support-annotations'
  109. })
  110. compile 'com.android.support:appcompat-v7:25.3.1'
  111. compile 'com.android.support:cardview-v7:25.3.1'
  112. compile 'com.android.support:design:25.3.1'
  113. compile 'com.android.support:recyclerview-v7:25.3.1'
  114.  
  115. compile 'com.android.support:percent:25.3.1'
  116.  
  117. compile 'com.google.code.gson:gson:2.8.0'
  118.  
  119. compile "android.arch.persistence.room:runtime:$room_version"
  120. kapt "android.arch.persistence.room:compiler:$room_version"
  121.  
  122. compile "org.jetbrains.anko:anko-sdk15:$anko_version"
  123. compile "org.jetbrains.anko:anko-support-v4:$anko_version"
  124. compile "org.jetbrains.anko:anko-appcompat-v7:$anko_version"
  125.  
  126. testCompile 'junit:junit:4.12'
  127. compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
  128. }
  129.  
  130. repositories {
  131. mavenCentral()
  132. }
  133.  
  134. buildscript {
  135. ext.kotlin_version = '1.1.3-2'
  136. ext.gradle_version = '3.0.0-alpha6'
  137. ext.anko_version = '0.9.1'
  138. ext.room_version = '1.0.0-alpha5'
  139. repositories {
  140. jcenter()
  141. }
  142. dependencies {
  143. classpath 'com.android.tools.build:gradle:3.0.0-alpha8'
  144. classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
  145. }
  146. }
  147.  
  148. allprojects {
  149. repositories {
  150. jcenter()
  151. maven { url 'https://maven.google.com' }
  152. }
  153. }
  154.  
  155. task clean(type: Delete) {
  156. delete rootProject.buildDir
  157. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement